#include using namespace std; #define rep(i,N) for(int i=0;i inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1e9; const ll INFLL = 1e18; const ll MOD = 1e9+7; const double PI = acos(-1.0); const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; /*------------------------------------/ for library*/ /*------------------------------------*/ int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); int N; cin>>N; vector P(N); rep(i,N){ cin>>P[i]; } int K = 1; rep(i,N){ string x = to_string(P[i]); int tmp = 0; rep(j,(int)x.size()){ tmp += x[j] - '0'; } K *= tmp; while(to_string(K).size()>1){ string K_st = to_string(K); int cnt = 0; rep(j,(int)K_st.size()){ cnt += K_st[j]-'0'; } K = cnt; } } cout<