#include <bits/stdc++.h>
using namespace std;
int v[1000], timp[1000];
int main() {
  int n, i, j, k, ma = 1000000000;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> v[i];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= v[i]; j++) {
      cin >> k;
      timp[i] += k * 5 + 15;
    }
    if (ma > timp[i]) ma = timp[i];
  }
  cout << ma;
  return 0;
}
