#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c> n; vll a(n); ll ans = 1; //1~9 re(i, n){ scanf("%lld", &a[i]); if(a[i]==0){ std::cout << 0 << '\n'; return 0; } ans = (ans * (a[i]%9))%9; if(ans==0) ans = 9; } std::cout << ans << '\n'; }