def getN():

    return int(eval(input()))

def getNM():

    return list(map(int, input().split()))

def getList():

    return list(map(int, input().split()))

def getArray(intn):

    return [int(eval(input())) for i in range(intn)]

def input():

    return sys.stdin.readline().rstrip()

def rand_N(ran1, ran2):

    return random.randint(ran1, ran2)

def rand_List(ran1, ran2, rantime):

    return [random.randint(ran1, ran2) for i in range(rantime)]

def rand_ints_nodup(ran1, ran2, rantime):

  ns = []

  while len(ns) < rantime:

    n = random.randint(ran1, ran2)

    if not n in ns:

      ns.append(n)

  return sorted(ns)



def rand_query(ran1, ran2, rantime):

  r_query = []

  while len(r_query) < rantime:

    n_q = rand_ints_nodup(ran1, ran2, 2)

    if not n_q in r_query:

      r_query.append(n_q)

  return sorted(r_query)



from collections import defaultdict, deque, Counter

from sys import exit

from decimal import *

from heapq import heapify, heappop, heappush

import math

import random

import string

from copy import deepcopy

from itertools import combinations, permutations, product

from operator import mul, itemgetter

from functools import reduce

from bisect import bisect_left, bisect_right



import sys

sys.setrecursionlimit(1000000000)

mod = 10 ** 9 + 7



#############

# Main Code #

#############



S = getN()



# 逆元事前処理ver

# nが小さい場合に

lim = 10 ** 5 + 1

fact = [1, 1]

factinv = [1, 1]

inv = [0, 1]



for i in range(2, lim + 1):

    fact.append((fact[-1] * i) % mod)

    inv.append((-inv[mod % i] * (mod // i)) % mod)

    # 累計

    factinv.append((factinv[-1] * inv[-1]) % mod)



def cmb(n, r):

    if (r < 0) or (n < r):

        return 0

    r = min(r, n - r)

    return fact[n] * factinv[r] * factinv[n - r] % mod



ans = 0

# 長さNの時最低でも3 * N使う

# 残りは分配する

for i in range(1, 2001):

    s = S - (3 * i)

    if s < 0:

        break

    # sをN個に分配する通りがいくつあるか

    # 重複組み合わせ

    # 仕切りの数はi - 1個

    ans += cmb(s + i - 1, i - 1)

print((ans % mod))
def getN():

    return int(eval(input()))

def getNM():

    return list(map(int, input().split()))

def getList():

    return list(map(int, input().split()))

def getArray(intn):

    return [int(eval(input())) for i in range(intn)]

def input():

    return sys.stdin.readline().rstrip()

def rand_N(ran1, ran2):

    return random.randint(ran1, ran2)

def rand_List(ran1, ran2, rantime):

    return [random.randint(ran1, ran2) for i in range(rantime)]

def rand_ints_nodup(ran1, ran2, rantime):

  ns = []

  while len(ns) < rantime:

    n = random.randint(ran1, ran2)

    if not n in ns:

      ns.append(n)

  return sorted(ns)



def rand_query(ran1, ran2, rantime):

  r_query = []

  while len(r_query) < rantime:

    n_q = rand_ints_nodup(ran1, ran2, 2)

    if not n_q in r_query:

      r_query.append(n_q)

  return sorted(r_query)



from collections import defaultdict, deque, Counter

from sys import exit

from decimal import *

from heapq import heapify, heappop, heappush

import math

import random

import string

from copy import deepcopy

from itertools import combinations, permutations, product

from operator import mul, itemgetter

from functools import reduce

from bisect import bisect_left, bisect_right



import sys

sys.setrecursionlimit(1000000000)

mod = 10 ** 9 + 7



#############

# Main Code #

#############



N = getN()

logk = N.bit_length()



# 漸化式にできるなら行列計算に落とし込める

# A[n] = A[n - 1] + A[n - 3]なので

# [a2, a1, a0] = [0, 0, 1]

# [[1, 1, 0], [0, 0, 1], [1, 0, 0]]のN乗をすれば

# [an+2, an+1, an] が出る



dp = [[[0, 0, 0] for i in range(3)] for i in range(logk)]

dp[0] = [

[1, 1, 0],

[0, 0, 1],

[1, 0, 0]

]



# 行列掛け算 O(n3)かかる

def array_cnt(ar1, ar2):

    h = len(ar1)

    w = len(ar2[0])

    row = ar1

    col = []

    for j in range(w):

        opt = []

        for i in range(len(ar2)):

            opt.append(ar2[i][j])

        col.append(opt)



    res = [[[0, 0] for i in range(w)] for i in range(h)]

    for i in range(h):

        for j in range(w):

            cnt = 0

            for x, y in zip(row[i], col[j]):

                cnt += x * y

            res[i][j] = cnt

            res[i][j] %= mod

    return res



for i in range(1, logk):

    dp[i] = array_cnt(dp[i - 1], dp[i - 1])



ans = [[0, 0, 1]]

for i in range(logk):

    if N & (1 << i):

        ans = array_cnt(ans, dp[i])

print((ans[0][2] % mod))
def getN():
    return int(eval(input()))


def getNM():
    return list(map(int, input().split()))


def getList():
    return list(map(int, input().split()))


def getArray(intn):
    return [int(eval(input())) for i in range(intn)]


def input():
    return sys.stdin.readline().rstrip()


def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)


def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]


def rand_ints_nodup(ran1, ran2, rantime):
    ns = []
    while len(ns) < rantime:
        n = random.randint(ran1, ran2)
        if not n in ns:
            ns.append(n)
    return sorted(ns)


def rand_query(ran1, ran2, rantime):
    r_query = []
    while len(r_query) < rantime:
        n_q = rand_ints_nodup(ran1, ran2, 2)
        if not n_q in r_query:
            r_query.append(n_q)
    return sorted(r_query)


from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right
import sys

sys.setrecursionlimit(1000000000)
mod = 10**9 + 7
#############
# Main Code #
#############
S = getN()
# 逆元事前処理ver
# nが小さい場合に
lim = 10**5 + 1
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, lim + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    # 累計
    factinv.append((factinv[-1] * inv[-1]) % mod)


def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % mod


ans = 0
# 長さNの時最低でも3 * N使う
# 残りは分配する
for i in range(1, 2001):
    s = S - (3 * i)
    if s < 0:
        break
    # sをN個に分配する通りがいくつあるか
    # 重複組み合わせ
    # 仕切りの数はi - 1個
    ans += cmb(s + i - 1, i - 1)
print((ans % mod))

def getN():
    return int(eval(input()))


def getNM():
    return list(map(int, input().split()))


def getList():
    return list(map(int, input().split()))


def getArray(intn):
    return [int(eval(input())) for i in range(intn)]


def input():
    return sys.stdin.readline().rstrip()


def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)


def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]


def rand_ints_nodup(ran1, ran2, rantime):
    ns = []
    while len(ns) < rantime:
        n = random.randint(ran1, ran2)
        if not n in ns:
            ns.append(n)
    return sorted(ns)


def rand_query(ran1, ran2, rantime):
    r_query = []
    while len(r_query) < rantime:
        n_q = rand_ints_nodup(ran1, ran2, 2)
        if not n_q in r_query:
            r_query.append(n_q)
    return sorted(r_query)


from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right
import sys

sys.setrecursionlimit(1000000000)
mod = 10**9 + 7
#############
# Main Code #
#############
N = getN()
logk = N.bit_length()
# 漸化式にできるなら行列計算に落とし込める
# A[n] = A[n - 1] + A[n - 3]なので
# [a2, a1, a0] = [0, 0, 1]
# [[1, 1, 0], [0, 0, 1], [1, 0, 0]]のN乗をすれば
# [an+2, an+1, an] が出る
dp = [[[0, 0, 0] for i in range(3)] for i in range(logk)]
dp[0] = [[1, 1, 0], [0, 0, 1], [1, 0, 0]]
# 行列掛け算 O(n3)かかる
def array_cnt(ar1, ar2):
    h = len(ar1)
    w = len(ar2[0])
    row = ar1
    col = []
    for j in range(w):
        opt = []
        for i in range(len(ar2)):
            opt.append(ar2[i][j])
        col.append(opt)
    res = [[[0, 0] for i in range(w)] for i in range(h)]
    for i in range(h):
        for j in range(w):
            cnt = 0
            for x, y in zip(row[i], col[j]):
                cnt += x * y
            res[i][j] = cnt
            res[i][j] %= mod
    return res


for i in range(1, logk):
    dp[i] = array_cnt(dp[i - 1], dp[i - 1])
ans = [[0, 0, 1]]
for i in range(logk):
    if N & (1 << i):
        ans = array_cnt(ans, dp[i])
print((ans[0][2] % mod))

-S = getN() -# 逆元事前処理ver -# nが小さい場合に -lim = 10**5 + 1 -fact = [1, 1] -factinv = [1, 1] -inv = [0, 1] -for i in range(2, lim + 1): -    fact.append((fact[-1] * i) % mod) -    inv.append((-inv[mod % i] * (mod // i)) % mod) -    # 累計 -    factinv.append((factinv[-1] * inv[-1]) % mod) +N = getN() +logk = N.bit_length() +# 漸化式にできるなら行列計算に落とし込める +# A[n] = A[n - 1] + A[n - 3]なので +# [a2, a1, a0] = [0, 0, 1] +# [[1, 1, 0], [0, 0, 1], [1, 0, 0]]のN乗をすれば +# [an+2, an+1, an] が出る +dp = [[[0, 0, 0] for i in range(3)] for i in range(logk)] +dp[0] = [[1, 1, 0], [0, 0, 1], [1, 0, 0]] +# 行列掛け算 O(n3)かかる +def array_cnt(ar1, ar2): +    h = len(ar1) +    w = len(ar2[0]) +    row = ar1 +    col = [] +    for j in range(w): +        opt = [] +        for i in range(len(ar2)): +            opt.append(ar2[i][j]) +        col.append(opt) +    res = [[[0, 0] for i in range(w)] for i in range(h)] +    for i in range(h): +        for j in range(w): +            cnt = 0 +            for x, y in zip(row[i], col[j]): +                cnt += x * y +            res[i][j] = cnt +            res[i][j] %= mod +    return res -def cmb(n, r): -    if (r < 0) or (n < r): -        return 0 -    r = min(r, n - r) -    return fact[n] * factinv[r] * factinv[n - r] % mod - - -ans = 0 -# 長さNの時最低でも3 * N使う -# 残りは分配する -for i in range(1, 2001): -    s = S - (3 * i) -    if s < 0: -        break -    # sをN個に分配する通りがいくつあるか -    # 重複組み合わせ -    # 仕切りの数はi - 1個 -    ans += cmb(s + i - 1, i - 1) -print((ans % mod)) +for i in range(1, logk): +    dp[i] = array_cnt(dp[i - 1], dp[i - 1]) +ans = [[0, 0, 1]] +for i in range(logk): +    if N & (1 << i): +        ans = array_cnt(ans, dp[i]) +print((ans[0][2] % mod))