import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.bigint; // BigInt void main() { auto l = readln.chomp.to!int; if (l == 1) { writeln(1); writeln(1); } else if (l == 2) { writeln(3); writeln("INF"); } else { writeln(l); if (l % 2 == 0) writeln(calc(l) - calc(l/2) ^^ 2); else writeln(calc(l)); } } auto calc(int l) { auto o = BigInt(1), z = BigInt(0); auto a = [[o,o],[o,z]]; auto im = [[o,z],[z,o]]; auto b = repeatedSquare!(BigInt[][], matMul)(a, l-2, im); return matMulVec(b, [o,o])[0]; } T[][] matMul(T)(T[][] a, T[][] b) { auto l = b.length, m = a.length, n = b[0].length; auto c = new T[][](m, n); foreach (i; 0..m) foreach (j; 0..n) foreach (k; 0..l) c[i][j] += a[i][k] * b[k][j]; return c; } T[] matMulVec(T)(T[][] a, T[] b) { auto l = b.length, m = a.length; auto c = new T[](m); foreach (i; 0..m) foreach (j; 0..l) c[i] += a[i][j] * b[j]; return c; } T repeatedSquare(T, alias pred = "a * b", U)(T a, U n, T init) { import std.functional; alias predFun = binaryFun!pred; if (n == 0) return init; auto r = init; while (n > 0) { if ((n & 1) == 1) r = predFun(r, a); a = predFun(a, a); n >>= 1; } return r; }