#include <iostream>

template<int Day> struct DailyWinnings { enum { value = 0 }; };

template<> struct DailyWinnings<0> { enum { value = 158 }; };
template<> struct DailyWinnings<1> { enum { value = 44 }; };
template<> struct DailyWinnings<2> { enum { value = 196 }; };
template<> struct DailyWinnings<3> { enum { value = 399 }; };
template<> struct DailyWinnings<4> { enum { value = 47 }; };
template<> struct DailyWinnings<5> { enum { value = 2 }; };
template<> struct DailyWinnings<6> { enum { value = -158 }; };
template<> struct DailyWinnings<7> { enum { value = -197 }; };
template<> struct DailyWinnings<8> { enum { value = 375 }; };
template<> struct DailyWinnings<9> { enum { value = 121 }; };
template<> struct DailyWinnings<10> { enum { value = 806 }; };
template<> struct DailyWinnings<11> { enum { value = 44 }; };
template<> struct DailyWinnings<12> { enum { value = 953 }; };
template<> struct DailyWinnings<13> { enum { value = 7 }; };
template<> struct DailyWinnings<14> { enum { value = 20 }; };
template<> struct DailyWinnings<15> { enum { value = 1 }; };
template<> struct DailyWinnings<16> { enum { value = 7 }; };
template<> struct DailyWinnings<17> { enum { value = 88 }; };
template<> struct DailyWinnings<18> { enum { value = 191 }; };
template<> struct DailyWinnings<19> { enum { value = 33 }; };
template<> struct DailyWinnings<20> { enum { value = 654 }; };
template<> struct DailyWinnings<21> { enum { value = 156 }; };
template<> struct DailyWinnings<22> { enum { value = 321 }; };
template<> struct DailyWinnings<23> { enum { value = 784 }; };
template<> struct DailyWinnings<24> { enum { value = -111 }; };
template<> struct DailyWinnings<25> { enum { value = 159 }; };
template<> struct DailyWinnings<26> { enum { value = 88 }; };
template<> struct DailyWinnings<27> { enum { value = 49 }; };
template<> struct DailyWinnings<28> { enum { value = 25 }; };
template<> struct DailyWinnings<29> { enum { value = 366 }; };
template<> struct DailyWinnings<30> { enum { value = 861 }; };
template<> struct DailyWinnings<31> { enum { value = 869 }; };
template<> struct DailyWinnings<32> { enum { value = 380 }; };


template<int A, int B>
struct Max
{
    enum { value = A > B ? A : B };
};

template<int A>
struct BestResult
{
    enum {
        value = Max< DailyWinnings<A>::value + BestResult<A + 2>::value, BestResult<A + 1>::value >::value
    };
};
template<> struct BestResult<33> { enum { value = 0 }; };
template<> struct BestResult<34> { enum { value = 0 }; };


int main()
{
    std::cout << BestResult<0>::value << "\n";
}

