#include<bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n){ int t=0,i; for(i=23;t!=n;i++){ if(i%3==2&&i%5==3&&i%7==2) t++; } cout<<i-1<<endl; } return 0; }
Double click to view unformatted code.