#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return gcd(b, a % b); }
int a[100], v[100];
int main() {
  ios::sync_with_stdio(false);
  int n, m, Max, ans;
  while (cin >> n) {
    Max = 0x7fffffff;
    for (int i = 0; i < n; i++) cin >> a[i];
    memset(v, 0, sizeof(v));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < a[i]; j++) {
        cin >> m;
        v[i] += m;
      }
    }
    for (int i = 0; i < n; i++) {
      ans = v[i] * 5;
      ans += a[i] * 15;
      Max = min(Max, ans);
    }
    cout << Max << endl;
  }
  return 0;
}
