#include using namespace std; #define rep(i,n) for(ll i=0;i<(n);++i) using ll = long long; using pll = pair; constexpr ll INF = (1LL<<60); constexpr ll MOD = (1e9+7); //constexpr ll MOD = (998244353); template bool chmax(T &a,const T &b){if(a bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;} void dump(){cerr< void dump(T&& h, Ts&&... t){cerr<(t)...);} template istream &operator>>(istream&is,vector&v){for(auto &elemnt:v)is>>elemnt;return is;} template istream &operator>>(istream&is,pair&p){is>>p.first>>p.second;return is;} templatevector make_vector(size_t a){return vector(a);} templateauto make_vector(size_t a, Ts... ts){return vector(ts...))>(a, make_vector(ts...));} signed main(){ ll n; cin>>n; vector a(n); cin>>a; auto f = [](ll p){ ll x=0; while(p){ x+=p%10; p/=10; } return x; }; for(auto& ai:a){ while(ai>=10)ai = f(ai); } ll ans = 1; for(auto ai:a){ ans*=ai; ans = f(ans); } while(ans>=10)ans=f(ans); cout<<(ans)<