#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k[100];
  int m[100][100];
  int t[100];
  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];
  for (int i = 0; i < n; ++i) {
    t[i] = k[i] * 3;
    for (int j = 0; j < k[i]; ++j) t[i] += m[i][j];
    t[i] = t[i] * 5;
  }
  int mm = t[0];
  for (int i = 1; i < n; ++i)
    if (t[i] < mm) mm = t[i];
  cout << mm;
  return 0;
}
