You are given a 3×4 grid of unit squares. Two cells are green; the other ten are white.
c=0 c=1 c=2 c=3
+--------+--------+--------+--------+
r=0 | ## 49 | | | 6 |
+--------+--------+--------+--------+
r=1 | | | 9 | 49 |
+--------+--------+--------+--------+
r=2 | | ## 9 | | |
+--------+--------+--------+--------+
## = green cell. Cell (r, c) is row r (top = 0), column c (left = 0).
Rules.
- Draw a 90-degree arc in some of the white cells. An arc is a quarter circle of radius 1 that joins one corner of its cell to the diagonally opposite corner, so its centre is one of the cell's other two corners. In each cell you may use either diagonal (either pair of opposite corners) and either of the two possible centres, so a cell has four possible arcs. Each white cell holds at most one arc. Green cells never hold an arc.
- The arcs and the outer border are the only walls. Grid lines are not walls. Together the walls cut the grid into regions. Two parts belong to the same region only if they share a stretch of boundary of positive length; parts that touch at a single point only are in different regions.
- Every region must have an integer area.
- No arc may "dangle": the two parts of a cell that holds an arc must lie in two different regions.
- The score of a region is its area multiplied by the number of smooth pieces in its perimeter. A smooth piece is a maximal stretch of the boundary along which the direction changes continuously (the curve is C¹). The boundary breaks into a new piece wherever it has a corner or a cusp. A change of curvature without a change of direction, such as a straight line running tangentially into an arc, does not break it. Where an arc ends on a wall (the border or another arc) and is tangent to it there, the two sides differ: the region pinched between the arc and that wall sees a cusp (a new piece), while the region on the other side of the arc sees the arc run smoothly into the wall (no new piece). If the boundary consists of several closed curves, count the pieces of each and add them; a closed curve with no corner or cusp at all counts as 1 piece. For example, a 1×1 square has 4 smooth pieces, so its score is 1 × 4 = 4.
- A number in a cell, green or white, gives the score of the region that contains at least half of that cell (all of it, if the cell has no arc; otherwise the larger of its two parts).
There is exactly one way to draw the arcs.
Task. When the arcs are drawn, write in every cell the score of the region that contains at least half of it. Take the sum of each of the 3 rows and each of the 4 columns. Your answer is the sum of the squares of the 3 row sums plus the sum of the squares of the 4 column sums.
Answer format: a single integer (for example 12345).