#include <bits/stdc++.h>
using namespace std;
int N, K[100], M[100][100];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> K[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < K[i]; j++) {
      cin >> M[i][j];
    }
  }
  int ret = 100000000;
  for (int i = 0; i < N; i++) {
    int time = 0;
    for (int j = 0; j < K[i]; j++) {
      time += M[i][j] * 5;
    }
    time += 15 * K[i];
    ret = min(ret, time);
  }
  cout << ret << endl;
  return 0;
}
