#include #include using namespace std; int main(){ int A; cin >> A; vector ans = {7,1}; for(int x=2; x<=100; x++){ int tmp = A; vector hoge; while(tmp){ hoge.push_back(tmp%x); tmp /= x; } if(hoge == ans){ cout << x << endl; return 0; } } cout << -1 << endl; return 0; }