#include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int MOD=1e9+7; int main() { cin.tie(0),cout.tie(0); ios::sync_with_stdio(false); ll n,p[100005]={},ans=1,cnt=0,x,A,y,B; cin >> n; for(int i=0; i> p[i]; x=p[i]; cnt=0; while(x>0) { cnt+=x%10; x/=10; } ans*=cnt; B=ans; while(B>9) { B=0; while(ans>0) { B+=ans%10; ans/=10; } ans=B; } } A=ans; while(A>9) { A=0; while(ans>0) { A+=ans%10; ans/=10; } ans=A; } cout << A << endl; }