#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; int main(){ int N; cin >> N; vector v; rep(i,N){ ll a; cin >> a; v.push_back(a); } ll ret = 1; rep(i,N){ ll x = v[i]; while(x>=10){ ll t = 0; while(x>0){ t += x % 10; x /= 10; } x = t; } ret *= x; while(ret>=10){ ll t = 0; while(ret>0){ t += ret % 10; ret /= 10; } ret = t; } } cout << ret << endl; return 0; }