#include <bits/stdc++.h>
using namespace std;
int main() {
  long i, j, a, b, c, n, num[105], val[105][105];
  while (scanf("%ld", &n) == 1) {
    for (i = 0; i < n; i++) scanf("%ld", &num[i]);
    for (i = 0; i < n; i++) {
      for (j = 0; j < num[i]; j++) scanf("%ld", &val[i][j]);
    }
    b = 100000000;
    for (i = 0; i < n; i++) {
      a = 0;
      for (j = 0; j < num[i]; j++) a = a + val[i][j] * 5;
      a = a + j * 15;
      b = min(a, b);
    }
    printf("%ld\n", b);
  }
  return 0;
}
