A tile decoration in a park is made of square tiles glued together in a spiral, like the shell of a nautilus. It starts with a tile of side 1, and every tile added further out is larger. Part of the decoration looks like this.

The number written on a tile is the length of its side. Reading the side lengths from the innermost tile outward gives 1, 1, 2, 3, 5, 8, ... . From the third tile on, the side length of a tile is the sum of the side lengths of the two tiles before it.
Gluing N tiles together by this rule always produces a single rectangle. For example, the rectangle formed by the first five tiles (drawn in red in the picture) has perimeter 26.
Given the number of tiles N, write a program that computes the perimeter of the rectangle formed by those N tiles.