in Competitive programming

SPOJ COINS solution

Solution for problem http://www.spoj.com/problems/COINS/ from SPOJ website.

Sometimes I stuck solving some problems from there (usually because my code either add unneeded new line or doesn’t add needed new line and I am finding what is wrong by trial and error), so here is working solution for COINS that can save you time if you encounter some strange Wrong Answer or NZEC errors.

Solution is pretty straightforward – use recursive descent to find global optimal solution. To win some calculation time, we will precalculate first 0 \leqslant N \leqslant 9000 steps. Source code limit is 50KB, so you can’t fit more precalculated steps without compression or tricks, however even 9000 precalculated steps is enough to solve the problem.

C++ Solution:

#include <iostream>
#include <cmath>

using namespace std;

const long long precomputed[] = {0,1,2,3,4,5,6,7,8,9,10,11,13,13,14,15,17,17,19,19,21,22,23,23,27,27,27,28,30,30,32,32,35,36,36,36,41,41,41,41,44,44,46,46,48,49,49,49,57,57,57,57,57,57,60,60,63,63,63,63,68,68,68,69,74,74,76,76,76,76,76,76,87,87,87,87,87,87,87,87,92,93,93,93,98,98,98,98,101,101,104,104,104,104,104,104,119,119,119,120,120,120,120,120,120,120,120,120,129,129,129,129,134,134,134,134,134,134,134,134,144,144,144,144,144,144,147,147,155,155,155,155,160,160,160,161,161,161,161,161,161,161,161,161,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,193,193,197,197,197,197,197,197,207,207,207,207,207,207,207,207,212,212,212,212,221,221,221,221,221,221,221,221,221,222,222,222,250,250,250,250,250,250,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,276,276,276,276,276,276,276,276,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,304,304,304,305,305,305,305,305,305,305,305,305,314,314,314,314,327,327,327,327,327,327,327,327,337,337,337,337,337,337,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,391,391,391,391,391,391,391,391,391,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,405,405,405,405,419,419,419,419,419,419,419,419,419,419,419,419,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,447,447,447,447,447,447,447,447,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,473,473,473,473,473,473,524,524,524,524,524,524,524,524,524,524,524,524,533,533,533,533,533,533,533,533,533,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,641,641,641,641,641,641,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,668,668,668,668,668,668,668,668,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,709,709,709,709,709,709,709,709,709,709,709,709,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,724,724,724,724,724,724,724,724,724,826,826,826,826,826,826,826,826,826,826,826,826,826,826,826,826,826,826,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,851,851,851,851,851,851,851,851,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,943,943,943,943,943,943,943,943,943,943,943,943,943,943,943,943,994,994,994,994,994,994,994,994,994,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,1009,1009,1009,1009,1009,1009,1009,1009,1009,1009,1009,1009,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1258,1258,1258,1258,1258,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1350,1350,1350,1350,1350,1350,1350,1350,1350,1350,1350,1350,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2678,2678,2678,2678,2678,2678,2678,2678,2678,2678,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620};

long long solve(long long N)
{
    if (N < sizeof(precomputed)/sizeof(long long)) {
        return precomputed[N];
    }

    long long nd2 = N / 2;
    long long nd3 = N / 3;
    long long nd4 = N / 4;

    long long nsd2 = solve(nd2);
    long long nsd3 = solve(nd3);
    long long nsd4 = solve(nd4);

    long long eq2 = nsd2 > nd2 ? nsd2 : nd2;
    long long eq3 = nsd3 > nd3 ? nsd3 : nd3;
    long long eq4 = nsd4 > nd4 ? nsd4 : nd4;

    long long eqSum = eq2 + eq3 + eq4;

    return N < eqSum ? eqSum : N;
}

int main()
{
    long long N;
    
    for (; !feof(stdin); ) {
        scanf("%lld\n", &N);
        cout << solve(N) << endl;
    }

    return 0;
}

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.