#include using lint=long long; void cmx(lint&x,lint y){if(xy)x=y;} int main(){ std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false); std::cout.setf(std::ios_base::fixed);std::cout.precision(15); lint n;std::cin>>n; std::vectora(n); for(auto&&s:a)std::cin>>s; auto cal=[&](char c){ return std::isdigit(c)?c-'0':c-'A'+10; }; lint base=0; for(auto&&s:a)for(char c:s){ cmx(base,cal(c)); } base++; lint ans=std::numeric_limits::max(); for(auto&&s:a){ lint now=0; for(char c:s){ now=base*now+cal(c); } cmn(ans,now); } std::cout<