#include #include #include using namespace std; int main() { int r,s,m,d,n; cin>>r>>s>>m>>d>>n; vector brands(r); for (int i=0; i> brands[i]; } vector> dish(s+m+d); for (int i=0; i>x; dish[i]=vector(x); for (int j=0; j>dish[i][j]; dish[i][j]--; } } set> bad; for (int i=0; i>x>>y; x--; y--; if (x>y) swap(x,y); bad.insert(make_pair(x,y)); } long long answer = 0; double approx = 0.0; for (int i=0; i ingr; for (int x : dish[i]) ingr.insert(x); for (int x : dish[j]) ingr.insert(x); for (int x : dish[k]) ingr.insert(x); long long add = 1; double approx_add = 1.0; for (int x : ingr) { add *= brands[x]; approx_add *= brands[x]; } answer += add; approx += approx_add; } } } if (approx <= 1.1e18 && answer <= (long long) 1e18) { cout << answer << endl; } else { cout << "too many" << endl; } return 0; }