import strutils, sequtils const MOD = int(1e9) + 7 proc matmul(a: var seq[seq[int]], b: var seq[seq[int]]): seq[seq[int]] = result = @[@[0, 0], @[0, 0]] result[0][0] = (a[0][0]*b[0][0] + a[0][1]*b[1][0]) mod MOD result[0][1] = (a[0][0]*b[0][1] + a[0][1]*b[1][1]) mod MOD result[1][0] = (a[1][0]*b[0][0] + a[1][1]*b[1][0]) mod MOD result[1][1] = (a[1][0]*b[0][1] + a[1][1]*b[1][1]) mod MOD proc matpow(a: var seq[seq[int]], n: var int): seq[seq[int]] = result = @[@[1, 0], @[0, 1]] while n > 0: if (n and 1) == 1: result = matmul(result, a) a = matmul(a, a) n = n shr 1 proc bigint2modint(bignum: string, md: int): int = result = 0 for c in bignum: result = (result * 10 + (c.ord - '0'.ord)) mod md if result == 0: result = md - 1 proc mod_pow(a: var int, n: var int, md: int): int = result = 1 while n > 0: if (n and 1) == 1: result = result * a mod md a = a * a mod md n = n shr 1 var n = stdin.readLine.parseInt res = 1 for i in 0..