#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  map<int, string> st;
  for (int i = 0; i < (n); i++) {
    string s;
    cin >> s;
    int a[10] = {0};
    scanf("%d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5],
          &a[6], &a[7]);
    a[0] *= 100;
    a[1] *= -50;
    int sum = 0;
    for (int j = 0; j < (8); j++) {
      sum += a[j];
    }
    st[sum] = s;
  }
  printf("%s", (--st.end())->second.c_str());
  return 0;
}
