#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (auto &i : v) cin >> i;
    long long ans = INT_MAX;
    for (long long i = 0; i < n; i++) {
      long long curr = 0;
      for (long long j = 0; j < v[i]; j++) {
        long long a;
        cin >> a;
        curr += (a * 5);
      }
      ans = min(ans, curr + v[i] * 15);
    }
    cout << ans;
  }
  return 0;
}
