#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c> n; init(); ll x = (n-2)%P, y = (n-3)%P, z = (n-4)%P; ll ans = (inv[2]*(x*y)%P)%P; //全て6回カウント、ただし2個被りは3回、3個被りは1回カウント if((n-4)%3==0) ans = (ans + 2)%P; ans = (ans + (3*(1+(z*inv[2])%P))%P )%P; ans = (ans * inv[6])%P; std::cout << ans << '\n'; return 0; }