#pragma GCC optimize ( "O3" ) #pragma GCC target ( "avx" ) #include using namespace std; using ll = long long; #define TYPE_OF( VAR ) remove_const::type >::type #define UNTIE ios_base::sync_with_stdio( false ); cin.tie( nullptr ) #define CEXPR( LL , BOUND , VALUE ) constexpr const LL BOUND = VALUE #define CIN( LL , A ) LL A; cin >> A #define ASSERT( A , MIN , MAX ) assert( MIN <= A && A <= MAX ) #define CIN_ASSERT( A , MIN , MAX ) CIN( TYPE_OF( MAX ) , A ); ASSERT( A , MIN , MAX ) #define QUIT return 0 #define COUT( ANSWER ) cout << ( ANSWER ) << "\n"; #define RETURN( ANSWER ) COUT( ANSWER ); QUIT int main() { UNTIE; CEXPR( ll , bound_N , 10000 ); CIN_ASSERT( N , 1 , bound_N ); ll Nq = N / 3; ll Nq2 = ( Nq * ( Nq + 1 ) ) / 2; ll Nr = N % 3; RETURN( 27 * Nq2 * Nq2 + ( 6 * Nq2 - 1 ) * Nq + ( Nr == 0 ? 0 : Nr == 1 ? N : ( N * ( N + 1 ) - 1 ) ) ); }