local mod = 1000000007LL local function badd(x, y) return (x + y) % mod end local function bmul(x, y) return (x * y) % mod end local function bsub(x, y) return x < y and x - y + mod or x - y end local function lltonumber(str) local ret = 0LL for i = 1, #str do ret = ret * 10LL + str:sub(i, i):byte() - 48 end return ret end local sn = io.read() local n = lltonumber(sn) n = n - 4LL local allsame = n % 3LL == 0LL and 1LL or 0LL local onediff = 1LL + (n / 2LL) if n % 3LL == 0LL then onediff = onediff - 1LL end local alldiff = bmul(500000004LL, bmul((n + 2LL) % mod, (n + 1LL) % mod)) alldiff = bsub(alldiff, allsame) alldiff = bsub(alldiff, bmul(3LL, onediff)) alldiff = bmul(166666668LL, alldiff) -- 1/6 local ret = (allsame + onediff + alldiff) % mod local retstr = tostring(ret):gsub("LL", "") print(retstr)