#include <bits/stdc++.h>
using namespace std;
int n, q[105], val[105], a;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &q[i]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < q[i]; j++) {
      scanf("%d", &a);
      val[i] += (a * 5) + 15;
    }
  }
  sort(val, val + n);
  printf("%d\n", val[0]);
  return 0;
}
