#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> f(n, vector<int>(10));
  vector<vector<int>> p(n, vector<int>(11));
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(10); j++) f[i][j];
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(11); j++) cin >> p[i][j];
  int res = -(1 << 30);
  for (int b = 1; b < (1 << 10); b++) {
    int cc = 0;
    for (int i = 0; i < (int)(n); i++) {
      int c = 0;
      for (int j = 0; j < (int)(10); j++) {
        if ((b >> j & 1) && f[i][j]) c++;
        cc += p[i][c];
      }
      if (res < cc) res = cc;
    }
  }
  cout << res << endl;
  return 0;
}
