#include <bits/stdc++.h>
using namespace std;
int a[103], sum[108] = {0}, s[108];
int main() {
  int n;
  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", &s[j]);
      sum[i - 1] += s[j] * 5 + 15;
    }
  }
  sort(sum, sum + n);
  printf("%d\n", sum[0]);
}
