#include #include #include using namespace std; typedef long long int ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector a(n); ll ans=1; for(int i=0;i> a[i]; if(a[i]){ ans*=(a[i]%9); ans%=9; } else{ cout << 0 << endl; return 0; } } cout << ans << endl; }