eolymp
bolt
Try our new interface for solving problems
Problems

Spaced Out

Spaced Out

Spaced Out

Time limit 1 second
Memory limit 128 MiB
Input example #1
4
3 3 1 1
1 1 3 1
3 3 1 1
1 1 3 3
Output example #1
22
Source 2021 USACO Январь, Серебро