@staticmethod
def b():
    mod = 10007
    a = np.eye(N=3, k=(- 1), dtype=np.int64)
    a[0] = 1
    n = int(sys.stdin.readline().rstrip())
    a = Algebra.matrix_pow(a, (n - 1), mod)
    print(a[2][0])
@staticmethod
def b():
    mod = 10007
    a = np.eye(N=3, k=(- 1), dtype=np.int64)
    a[0] = 1
    n = int(sys.stdin.readline().rstrip())
    a = Algebra.matrix_pow(a, (n - 1), mod)
    print(a[2][0])