#include <bits/stdc++.h>
using namespace std;
bool pred(int n, int c, int pos[], int dist) {
  int cow = 1;
  int i = 1;
  int lastpos = pos[0];
  while (i < n) {
    if (pos[i] - lastpos >= dist) {
      cow++;
      lastpos = pos[i];
    }
    i++;
  }
  if (cow >= c)
    return true;
  else
    return false;
}
long long power(int x, int p) {
  if (p == 1)
    return x;
  else
    return x * power(x, p - 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  map<char, char> maps;
  vector<int> v;
  set<long long> st;
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    int val = 0;
    for (int j = 0; j < arr[i]; j++) {
      int x;
      cin >> x;
      val = val + x * 5 + 15;
    }
    v.push_back(val);
  }
  cout << *min_element(v.begin(), v.end());
  return 0;
}
