#include <bits/stdc++.h>
using namespace std;
int n, g = 1000 * 1000;
int a[111];
int b[111][111];
int s[111];
int h[111];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s[i] = a[i] * 15;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= a[i]; j++) {
      cin >> b[i][j];
      h[i] += b[i][j];
    }
    h[i] = h[i] * 5;
  }
  for (int i = 1; i <= n; i++) g = min((h[i] + s[i]), g);
  cout << g;
  return 0;
}
