#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int SZ = 110;
const int INF = 1000 * 1000 * 1000;
double start, finish;
void prepare(string s) {
  if ((int)s.size() != 0) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
  }
}
void startTimer() {}
void stopTimer() {}
int n;
vector<int> g;
vector<vector<int> > p;
void getData() {
  cin >> n;
  g.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> g[i];
  }
  p.resize(n);
  for (int i = 0; i < n; ++i) {
    p[i].resize(g[i]);
    for (int j = 0; j < g[i]; ++j) {
      cin >> p[i][j];
    }
  }
}
void solve() {
  int ans = INF;
  g.assign(n, 0);
  for (int i = 0; i < n; ++i) {
    int cnt = 0;
    for (int j = 0; j < (int)p[i].size(); ++j) {
      cnt += p[i][j] * 5 + 15;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}
int main() {
  prepare("");
  ios::sync_with_stdio(false);
  startTimer();
  getData();
  solve();
  stopTimer();
  return 0;
}
