#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, z = 0;
  cin >> n;
  vector<int> cashers;
  vector<int> items;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    z += k;
    cashers.push_back(k);
  }
  for (int f = 0; f < z; f++) {
    int x;
    cin >> x;
    items.push_back(x);
  }
  int j = 0;
  for (int i = 0; i < n; i++) {
    int d = cashers[i];
    while (d--) {
      arr[i] += (items[j] * 5);
      j++;
    }
    arr[i] += (cashers[i] * 15);
  }
  sort(arr.begin(), arr.end());
  cout << arr[0] << endl;
}
