An infinite square grid starts with one colored cell at minute 1. At each following minute, color every uncolored cell that shares an edge with a cell colored during an earlier minute. All additions within a minute happen simultaneously. Return the total number of colored cells after minute n.
Example 1:
Input: n = 3
Output: 13Explanation: The first minute colors 1 cell. The second adds its 4 edge-neighbors, and the third adds 8 more cells, for a total of 1 + 4 + 8 = 13.
Example 2:
Input: n = 4
Output: 25Explanation: The first three minutes color 13 cells. The fourth minute adds a new outer layer of 12 cells, bringing the total to 25.
Example 3:
Input: n = 5
Output: 41Explanation: After minute 4 there are 25 colored cells. Minute 5 adds the next outer layer of 16 cells, so the total becomes 41.
Constraints:
1 <= n <= 100000