#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> A(n);
  for (auto& _a : A) cin >> _a;
  vector<vector<ll>> M(n);
  ll min_time = INT64_MAX / 2;
  for (int i = 0; i < n; ++i) {
    vector<ll> V(A[i]);
    for (auto& x : V) cin >> x;
    ll sum = accumulate(V.begin(), V.end(), 0LL) * 5 + V.size() * 15;
    min_time = min(min_time, sum);
  }
  cout << min_time << '\n';
}
