#include <bits/stdc++.h>
using namespace std;
long long INF = 1000003;
vector<int> p;
string s;
void prime() {
  p.push_back(2);
  for (int i = 3;; ++i) {
    if (p[p.size() - 1] > 100000) {
      break;
    }
    bool t = true;
    for (int j = 0; j < p.size(); ++j) {
      if (i % p[j] == 0) {
        t = false;
        break;
      }
    }
    if (t) {
      p.push_back(i);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, a, b, c, d, e, m, p;
  cin >> n;
  vector<pair<int, string> > v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i].second >> p >> m >> a >> b >> c >> d >> e;
    v[i].first = p * 100 - m * 50 + a + b + c + d + e;
  }
  sort(v.begin(), v.end());
  cout << v[n - 1].second;
  return 0;
}
