lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end struct Mint @@MOD = 1_000_000_007i64 def self.mod @@MOD end def self.zero Mint.new end @value : Int64 def initialize @value = 0i64 end def initialize(value) @value = value.to_i64 % @@MOD end def initialize(m : Mint) @value = m.value end protected def value=(value : Int64) @value = value end getter value : Int64 def + : self self end def - : self Mint.new(value != 0 ? @@MOD - @value : 0) end def +(m) self + m.to_mint end def +(m : Mint) result = Mint.new result.value = @value + m.value result.value -= @@MOD if result.value >= @@MOD result end def -(m) self - m.to_mint end def -(m : Mint) result = Mint.new result.value = @value - m.value result.value += @@MOD if result.value < 0 result end def *(m) result = Mint.new result.value = @value * Mint.new(m).value % @@MOD result end def /(m) raise DivisionByZeroError.new if m == 0 a, b, u, v = m.to_i64, @@MOD, 1i64, 0i64 while b != 0 t = a // b a -= t * b a, b = b, a u -= t * v u, v = v, u end Mint.new(@value * u) end def //(m) self / m end def **(m : Int) t, res = self, Mint.new(1) while m > 0 res *= t if m.odd? t *= t m >>= 1 end res end def ==(m) @value == m.to_i64 end def !=(m) @value != m.to_i64 end def succ self + 1 end def pred self - 1 end def to_i64 : Int64 @value end delegate to_s, to: @value delegate inspect, to: @value end struct Int def to_mint : Mint Mint.new(self) end end class String def to_mint : Mint Mint.new(self) end end def sum_of_ap(first, diff, count) first = first.to_mint diff = diff.to_mint count = count.to_mint last = first + diff * count.pred (first + last) * count / 2 end n = read_line.to_i64 - 4 ans = (n // 3 + 1).to_mint ans += case n % 6 when 0 sum_of_ap(4, 6, n // 6) when 1 sum_of_ap(5, 6, n // 6) when 2 sum_of_ap(3, 6, -~n // 6) + n // 2 when 3 sum_of_ap(4, 6, n // 6) + n // 2 when 4 sum_of_ap(5, 6, n // 6) + n // 2 when 5 sum_of_ap(3, 6, -~n // 6) else raise "" end puts ans