// yukicoder My Practice // author: Leonardone @ NEETSDKASU #include typedef unsigned long ul; #define MD 1000000007UL // 解説読後 // http://yukicoder.me/problems/882/editorial int main(void) { register ul a=0UL, b = 1UL, c=0UL, ta, n; int k; scanf("%d", &k); n = k; while (--n) { ta = (b + c) % MD; c = b; b = a; a = ta; } printf("%lu\n", (a + b + c) % MD); return 0; }