#include <bits/stdc++.h>
#define INT long long int
using namespace std;
long long int i_S[30] = {33191,95944,30212,74104,94267,65317,40139,50698,9550,93926,22621,83868,59823,63902,99546,56537,9604,80339,9766,6906,22474,15255,12650,48764,85764,41511,48353,9660,0,100000};

char infile[100], outfile[100];

int main() {
    ios::sync_with_stdio(false);
    INT T, I, s, k;
    for(I=1;I<=30;I++){
        sprintf(infile, ".%d.in", I);
        freopen(infile, "w", stdout);
        printf("%lld\n",I-1);

        sprintf(outfile, ".%d.out", I);
        freopen(outfile, "w", stdout);
        
		printf("%lld\n", i_S[I-1]);
      }
}
