import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; class Main implements Runnable { public static void main(String[] args) { long t = System.currentTimeMillis(); new Main().run(); // new Thread(null, new Main(), "", // Runtime.getRuntime().maxMemory()).start(); System.err.println(System.currentTimeMillis() - t); } long MODULO = 1_000_000_000 + 7; @SuppressWarnings("unchecked") public void run() { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long[][] x = { { 1, 1 }, { 1, 0 } }; BigInteger[][] x_big = { { BigInteger.ONE, BigInteger.ONE }, { BigInteger.ONE, BigInteger.ZERO } }; // BigInteger[][] y_big = { { BigInteger.ZERO, BigInteger.valueOf(MODULO // - 1) }, // { BigInteger.valueOf(MODULO - 1), BigInteger.ONE } }; BigInteger fn = pow(x_big, n, MODULO * MODULO - 1)[1][0]; // tr(fn.divide(BigInteger.valueOf(MODULO))); // long r = new Long(fn.mod(BigInteger.valueOf(MODULO)).toString()); long[][] z = pow(x, new Long(fn.toString()), MODULO); System.out.println(z[1][0]); } long[][] mul(long[][] a, long[][] b, long MODULO) { long[][] ret = new long[2][2]; for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { for (int k = 0; k < 2; ++k) { ret[i][j] += a[i][k] % MODULO * b[k][j] % MODULO; ret[i][j] %= MODULO; } } } return ret; } BigInteger[][] mul(BigInteger[][] a, BigInteger[][] b, long MODULO) { BigInteger[][] ret = new BigInteger[2][2]; for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { ret[i][j] = BigInteger.ZERO; } } for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { for (int k = 0; k < 2; ++k) { ret[i][j] = ret[i][j].add(a[i][k].multiply(b[k][j])); ret[i][j] = ret[i][j].mod(BigInteger.valueOf(MODULO)); } } } return ret; } long[][] pow(long[][] a, long n, long MODULO) { long[][] ret = { { 1, 0 }, { 0, 1 } }; for (; n > 0; n >>= 1, a = mul(a, a, MODULO)) { if (n % 2 == 1) { ret = mul(ret, a, MODULO); } } return ret; } BigInteger[][] pow(BigInteger[][] a, long n, long MODULO) { BigInteger[][] ret = { { BigInteger.ONE, BigInteger.ZERO }, { BigInteger.ZERO, BigInteger.ONE } }; for (; n > 0; n >>= 1, a = mul(a, a, MODULO)) { if (n % 2 == 1) { ret = mul(ret, a, MODULO); } } return ret; } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }