#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int i=0;i<(n);i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) ((int)(x).size()) #define pb push_back using ll = long long; using namespace std; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> N; vector> A(N,vector(5)); rep(i,N){ rep(j,5){ cin >> A[i][j]; } } vector> C(16,vector(N)); rep(i,16){ rep(j,N){ ll a = A[j][0]; rep(k,4){ a += A[j][k+1] * ((i&(1<