#include <bits/stdc++.h> #define range 65 using namespace std; int main() { bool table[2000]={0}; int CNtable[66]; for(int a=1; a<range; a++) for(int b=a+1; b<range; b++) for(int c=b+1; c<range; c++) { if(a*b+b*c+a*c<=2000) table[a*b+b*c+a*c] = true; } int count = 1; for(int i=1; i<2000; i++) { if(table[i]==false) CNtable[count++] = i; } int n; while(cin >> n) { cout << CNtable[n] << endl; } }