#include <bits/stdc++.h>
using namespace std;
const int MAX = 0x7FFFFFFF;
const int MIN = 0x80000000;
int main() {
  int n, ans = MAX, k[128], v;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> k[i];
  for (int i = 0; i < n; i++) {
    int res = 0;
    for (int j = 0; j < k[i]; j++) {
      cin >> v;
      res = res + v * 5 + 15;
    }
    ans = min(res, ans);
  }
  cout << ans << endl;
  return 0;
}
