#pragma region おまじないα ver1 .08 //#define _CRT_SECURE_NO_WARNINGS //#pragma warning(disable : 4996) // using mint = modint1000000007; #pragma region 変化しないおまじない #include "bits/stdc++.h" #if __has_include("atcoder/all") #include "atcoder/all" using namespace atcoder; #endif #ifdef ONLINE_JUDGE #pragma GCC optimize("O3") #pragma GCC target( \ "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #endif using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() // sortなどの引数を省略 #define max3(x, y, z) max(x, max(y, z)) // 3変数min #define min3(x, y, z) min(x, min(y, z)) // 3変数max #define chmin(m, v) m = min((m), (v)) //最小値を更新 #define chmax(m, v) m = max((m), (v)) //最大値を更新 #define rep(i, n) repi(i, 0, n) // 0-N rep #define reps(i, n) repi(i, 1, n + 1) // 1-N #define repi(i, a, b) for (ll i = ll(a); i < ll(b); i++) // a-b #define prif(x) \ if (x) { \ cout << "Yes"; \ } else { \ cout << "No"; \ } #define PR pair // typedefだと予測が効かないっぽい? #ifdef _MSC_FULL_VER //手元なら #define dout cout #else #define dout \ if (false) cout #endif double dist(double x1, double y1, double x2, double y2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } ll idist(ll x1, ll y1, ll x2, ll y2) { return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } ll digitsum(ll N) { while (N >= 10) { int tmp = 0; while (N > 0) { tmp += (N % 10); N /= 10; } N = tmp; } return N; } struct qwqw { qwqw() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20); }; } aaaaaaa; #pragma endregion #pragma endregion int main(){ ll Q=4096; vector>> pat(Q, vector>(4, vector(6))); rep(i,4){ rep(j,4){ rep(k,4){ rep(l,4){ rep(m,4){ rep(n,4){ ll pid=i*1024+j*256+k*64+l*16+m*4+n; pat[pid][i][0]=1; pat[pid][j][1]=1; pat[pid][k][2]=1; pat[pid][l][3]=1; pat[pid][m][4]=1; pat[pid][n][5]=1; } } } } } } ll N; cin >> N; vector> T(N, vector(6)); rep(i,N){ cin >> T[i][0] >> T[i][1] >> T[i][2] >> T[i][3] >> T[i][4] >> T[i][5]; } ll gmx=0; rep(ctr,Q){ ll ft=1; rep(p,4){ ll pmx=0; rep(i,N){ pmx=max(pmx, max(1LL,pat[ctr][p][0]*T[i][0])* max(1LL,pat[ctr][p][1]*T[i][1])* max(1LL,pat[ctr][p][2]*T[i][2])* max(1LL,pat[ctr][p][3]*T[i][3])* max(1LL,pat[ctr][p][4]*T[i][4])* max(1LL,pat[ctr][p][5]*T[i][5])); } ft*=pmx; } gmx=max(ft,gmx); } cout << gmx << endl; }