L = gets.to_i p, q = 1, 0 l = (L % 2 == 0) ? (L / 2) : L 21.downto(0) { |h| p, q = p * p + q * q, 2 * p * q + q * q if ((l >> h) & 1) != 0 then p, q = q, p + q end } puts (L == 2) ? [q, :INF] : [L, (L % 2 == 0) ? (2 * p * q) : q]