#include <bits/stdc++.h>
using namespace std;
int n, ans = 1e9, k[111];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> k[i];
  for (int i = 0; i < n; i++) {
    int cur = 0;
    while (k[i]--) {
      int x;
      cin >> x;
      cur += 15 + 5 * x;
    }
    ans = min(ans, cur);
  }
  cout << ans << endl;
}
