#include <bits/stdc++.h>
using namespace std;
int a[111], b[111], x;
int main() {
  int n, ans = 0x3f3f3f3f;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= a[i]; j++) {
      scanf("%d", &x);
      b[i] += x * 5;
    }
    ans = min(ans, b[i] + a[i] * 15);
  }
  printf("%d\n", ans);
  return 0;
}
