Little Vasya went to the supermarket to get some groceries. He walked about the supermarket for a long time and got a basket full of products. Now he needs to choose the cashier to pay for the products.

There are n cashiers at the exit from the supermarket. At the moment the queue for the i-th cashier already has k_{i} people. The j-th person standing in the queue to the i-th cashier has m_{i}, j items in the basket. Vasya knows that:  the cashier needs 5 seconds to scan one item;  after the cashier scans each item of some customer, he needs 15 seconds to take the customer's money and give him the change. 

Of course, Vasya wants to select a queue so that he can leave the supermarket as soon as possible. Help him write a program that displays the minimum number of seconds after which Vasya can get to one of the cashiers.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 100) — the number of cashes in the shop. The second line contains n space-separated integers: k_1, k_2, ..., k_{n} (1 ≤ k_{i} ≤ 100), where k_{i} is the number of people in the queue to the i-th cashier.

The i-th of the next n lines contains k_{i} space-separated integers: m_{i}, 1, m_{i}, 2, ..., m_{i}, k_{i} (1 ≤ m_{i}, j ≤ 100) — the number of products the j-th person in the queue for the i-th cash has.


-----Output-----

Print a single integer — the minimum number of seconds Vasya needs to get to the cashier.


-----Examples-----
Input
1
1
1

Output
20

Input
4
1 4 3 2
100
1 2 2 3
1 9 1
7 8

Output
100



-----Note-----

In the second test sample, if Vasya goes to the first queue, he gets to the cashier in 100·5 + 15 = 515 seconds. But if he chooses the second queue, he will need 1·5 + 2·5 + 2·5 + 3·5 + 4·15 = 100 seconds. He will need 1·5 + 9·5 + 1·5 + 3·15 = 100 seconds for the third one and 7·5 + 8·5 + 2·15 = 105 seconds for the fourth one. Thus, Vasya gets to the cashier quicker if he chooses the second or the third queue.

Difficulty: EASY

Solutions:
n = int(input())
q = map(int, input().split())
rs = 10000000
for i in range(n):
	t = list(map(int, input().split()))
	rs = min(rs, sum(t) * 5 + len(t) * 15)
print(rs)


n = int(input())
k = list(map(int, input().split()))
m = 10 ** 10
for i in range(n):
	l = list(map(int, input().split()))
	s = 0
	for j in l:
		s = s + j * 5
	s = s + k[i] * 15
	if m > s:
		m = s
print(m)


from functools import reduce
from operator import *
from math import *
from sys import *
setrecursionlimit(10 ** 7)
RI = lambda : list(map(int, input().split()))
RS = lambda : input().rstrip().split()
n = RI()[0]
RI()
ans = 10 ** 7
for i in range(n):
	m = RI()
	val = 5 * sum(m) + 15 * len(m)
	ans = min(val, ans)
print(ans)


n = int(input())
k = list(map(int, input().split()))
m = list()
for i in range(n):
	m.append(list(map(int, input().split())))
sec = sum(m[0]) * 5 + len(m[0]) * 15
for i in range(1, n):
	v = sum(m[i]) * 5 + len(m[i]) * 15
	sec = min(v, sec)
print(sec)


n = int(input())
k = list(map(int, input().split()))
l = []
for i in range(n):
	a = list(map(int, input().split()))
	s = 0
	for j in a:
		s = s + j * 5
		s = s + 15
	l.append(s)
print(min(l))


n = int(input())
k = [int(i) for i in input().split()]
minn = 10 ** 9 + 7
for i in range(0, n):
	ms = sum([int(i) * 5 for i in input().split()])
	ms += k[i] * 15
	minn = min(minn, ms)
print(minn)


n = int(input())
l = list(map(int, input().split()))
t = []
for i in range(n):
	k = list(map(int, input().split()))
	p = 0
	for i in k:
		p += i * 5
	else:
		p += 15 * len(k)
		t += [p]
else:
	print(min(t))


num = int(input())
n = [int(x) for x in input().split()]
minsumm = -1
for i in range(0, num):
	summ = 0
	q = [int(x) for x in input().split()]
	for j in q:
		summ += 5 * j
		summ += 15
	if minsumm == -1:
		minsumm = summ
	elif minsumm > summ:
		minsumm = summ
print(minsumm)


n = int(input())
k = list(map(int, input().split()))
min = 10 ** 9
for i in range(n):
	l = list(map(int, input().split()))
	x = sum(l) * 5 + k[i] * 15
	if x < min:
		min = x
print(min)


n = int(input(''))
ar = list(map(int, input('').split()))
l = []
for i in range(n):
	ar1 = list(map(int, input('').split()))
	l.append(sum(ar1) * 5 + len(ar1) * 15)
print(min(l))


n = int(input())
Ks = []
a = input()
Ks = a.split()
time = []
for i in range(n):
	x = 0
	b = input()
	prod = b.split()
	for j in prod:
		x += int(j) * 5
		x += 15
	time.append(x)
print(min(time))


f = lambda : map(int, input().split())
n = int(input())
csh = list(f())
t = 1000000000
for i in range(n):
	a = list(f())
	t = min(t, sum(a) * 5 + 15 * csh[i])
print(t)


n = int(input())
k = list(map(int, input().split()))
k1 = []
for i in range(n):
	l = tuple(map(int, input().split()))
	k1.append(sum(l) * 5 + len(l) * 15)
print(min(k1))


n = int(input())
k = list(map(int, input().split()))
l = []
for i in range(len(k)):
	m = list(map(int, input().split()))
	r1 = len(m) * 15
	r2 = 0
	for i in range(len(m)):
		r2 = r2 + m[i]
	r = r1 + 5 * r2
	l.append(r)
print(min(l))


from math import inf

def solve(n, k, m):
	mini = inf
	for i in range(n):
		mini = min(mini, 5 * sum(m[i]) + len(m[i]) * 15)
	return mini

def main():
	n = int(input())
	k = list(map(int, input().split()))
	m = [list(map(int, input().split())) for _ in range(n)]
	print(solve(n, k, m))
main()


import sys
n = int(input())
k = list(map(int, input().split()))
best = sys.maxsize
for i in range(0, n):
	ls = list(map(int, input().split()))
	s = sum(ls)
	best = min(best, s * 5 + 15 * len(ls))
print(best)


I = lambda : list(map(int, input().split()))
n = int(input())
K = I()
print(min((5 * sum(I()) + 15 * K[i] for i in range(n))))


n = int(input())
lis = []
li = [int(c) for c in input().split()]
for i in range(n):
	l = [int(c) for c in input().split()]
	s = sum(l)
	lis.append(s * 5 + li[i] * 15)
print(min(lis))


def mot(g):
	return g * 5
a = int(input())
v = []
d = 0
x = input().split()
while True:
	if d < a:
		z = list(map(int, input().split()))
		t = list(map(mot, z))
		j = int(x[d]) * 15 + sum(t)
		v.append(j)
	else:
		break
	d += 1
print(min(v))


n = int(input())
ans = []
l = list(map(int, input().split()))
for i in l:
	c = 0
	c += i * 15
	it = list(map(int, input().split()))
	for j in it:
		c += j * 5
	ans.append(c)
print(min(ans))


min_w = 1000000
n = int(input())
k = input().split()
for _ in range(n):
	s = list(map(int, input().split()))
	w = sum(s) * 5 + len(s) * 15
	if w < min_w:
		min_w = w
print(min_w)


t = int(input())
l0 = [int(x) for x in input().split()]
l2 = []
for x in range(t):
	l1 = [int(x) for x in input().split()]
	l2.append(sum(l1) * 5 + 15 * len(l1))
print(min(l2))


n = int(input())
l = list(map(int, input().split()))
k = [15 * l[x] + sum(list(map(int, input().split()))) * 5 for x in range(n)]
print(min(k))


n = int(input())
arrayPeople = [int(i) for i in input().split()]
minimumTime = None
for i in range(n):
	timeOfLine = arrayPeople[i] * 15
	arrayProducts = [int(j) for j in input().split()]
	for j in range(arrayPeople[i]):
		timeOfLine += arrayProducts[j] * 5
	if minimumTime == None:
		minimumTime = timeOfLine
	elif timeOfLine < minimumTime:
		minimumTime = timeOfLine
print('%d' % minimumTime)


n = int(input())
list1 = list(map(int, input().split()))
list2 = []
for i in range(n):
	ll = list(map(int, input().split()))
	ss = sum(ll)
	list2.append(ss * 5 + len(ll) * 15)
print(min(list2))


n = int(input())
a = list(map(int, input().split()))
print(min((sum(list(map(int, input().split()))) * 5 + a[_] * 15 for _ in range(n))))


n = int(input())
l = list(map(int, input().split()))
l1 = []
for i in range(n):
	c = list(map(int, input().split()))
	x = 0
	for j in c:
		x = x + j * 5
	x = x + l[i] * 15
	l1.append(x)
print(min(l1))


kassa = int(input())
people = list(map(int, input().split()))
number = []
for i in range(len(people)):
	number.append(list(map(int, input().split())))
for i in range(len(number)):
	number[i] = sum(number[i]) * 5 + len(number[i]) * 15
print(min(number))


n = int(input())
fodac = input()
val = 100000
for i in range(n):
	val = min(val, sum((int(x) * 5 + 15 for x in input().split())))
print(val)


(d, n) = (30001, int(input()))
t = list(map(int, input().split()))
for i in range(n):
	s = sum(map(int, input().split())) + 3 * t[i]
	if s < d:
		d = s
print(d * 5)


x = int(input())
a = list(map(int, input().split()))
n = []
for i in range(x):
	n.append((lambda x: sum(x) * 5 + a[i] * 15)(list(map(int, input().split()))))
print(min(n))


n = int(input())
k = []
k = input().split()
for i in range(0, n):
	k[i] = int(k[i])
m = []
for i in range(0, n):
	m.append([int(j) for j in input().split()])
t = []
for i in range(0, n):
	x = k[i]
	time = 0
	for j in range(0, x):
		time = time + m[i][j] * 5
	time = time + k[i] * 15
	t.append(time)
print(min(t))


n = int(input())
k = [int(x) for x in input().split()]
minn = 10000000000
for _ in range(n):
	P = [int(x) for x in input().split()]
	s = 0
	for x in P:
		s += 15 + 5 * x
	minn = min(minn, s)
print(minn)


n = int(input())
k = list(map(int, input().split()))
m = []
for i in range(n):
	m.append(list(map(int, input().split())))
minval = 9999999999999
for i in m:
	count = 0
	for j in i:
		count += j * 5 + 15
	minval = min(count, minval)
print(minval)


N = int(input())
cashiers = []
K_unused = input().split()
for i in range(N):
	qu_sum = 0
	tmp = list(map(int, input().split()))
	queue = len(tmp)
	for e in tmp:
		qu_sum += e * 5 + 15
	cashiers.append(qu_sum)
print(min(cashiers))


n = int(input())
line = str(input()).split()
line = [int(it) for it in line]
res = list()
for i in range(n):
	array = str(input()).split()
	array = [int(it) for it in array]
	res.append(5 * sum(array) + 15 * line[i])
print(min(res))


num = int(input())
peeps = list(map(int, input().split()))
ans = float('inf')
for i in range(num):
	ans = min(ans, sum(map(int, input().split())) * 5 + peeps[i] * 15)
print(ans)


from sys import stdin, stdout

def istr():
	return input()

def inum():
	return int(stdin.readline())

def imul():
	return map(int, stdin.readline().split())

def ilst():
	return list(map(int, stdin.readline().split()))

def splt():
	return list(stdin.readline().strip())

def emat(row):
	return [inum() for i in range(row)]
max_itr = 100
modd = 10 ** 9 + 7
from itertools import combinations
import math
l = []
n = inum()
s = input()
for i in range(n):
	aa = ilst()
	aa = list(map(lambda x: x * 5 + 15, aa))
	l.append(sum(aa))
print(min(l))


n = int(input())
l = list(map(int, input().split()))
w = []
for i in range(n):
	s = 0
	k = list(map(int, input().split()))
	for j in range(l[i]):
		s += 5 * k[j]
	s += 15 * l[i]
	w.append(s)
w.sort()
print(w[0])


n = int(input())
k = map(int, input().split())
times = []
for i in range(n):
	people = list(map(int, input().split()))
	time = len(people) * 15
	for p in people:
		time += p * 5
	times.append(time)
print(min(times))


n = int(input())
c = list(map(int, input().strip().split()))
ans = 1 << 31
for i in range(n):
	ans = min(ans, sum([int(k) * 5 for k in input().split()]) + c[i] * 15)
print(ans)


Min = float('inf')
n = int(input())
k = list(map(int, input().split()))
for i in range(n):
	m = list(map(int, input().split()))
	y = sum(m) * 5 + k[i] * 15
	if y < Min:
		Min = y
print(Min)


n = int(input())
a = list(map(int, input().split()))
mini = 1000000000
for i in range(n):
	b = list(map(int, input().split()))
	sumi = sum(b) * 5 + len(b) * 15
	mini = min(mini, sumi)
print(mini)


n = int(input())
kassu = list(map(int, input().split()))
products = []
for i in range(n):
	products += [list(map(int, input().split()))]
result = []
for i in range(n):
	test_result = 0
	for j in range(kassu[i]):
		test_result += products[i][j] * 5 + 15
	result.append(test_result)
print(min(result))


read = lambda : map(int, input().split())
n = int(input())
k = list(read())
a = [list(read()) for i in range(n)]
ans = float('inf')
for i in range(n):
	cur = 15 * k[i]
	for j in range(k[i]):
		cur += 5 * a[i][j]
	ans = min(ans, cur)
print(ans)


n = int(input())
peoples = [int(x) for x in input().split()]
sums = []
for i in range(n):
	sums.append(sum([int(x) * 5 for x in input().split()]) + 15 * peoples[i])
print(min(sums))


n = int(input())
k = list(map(int, input().split()))
ans = []
for i in range(n):
	m = list(map(int, input().split()))
	r = 0
	for j in range(k[i]):
		r = r + m[j] * 5 + 15
	ans.append(r)
print(min(ans))


n = int(input())
arr = list(map(int, input().split()))
pos = list()
for i in range(n):
	items = list(map(int, input().split()))
	pos.append(sum(items) * 5 + len(items) * 15)
print(min(pos))


n = int(input())
k = list(map(int, input().split()))
max = 0
min = 1000000
for i in range(n):
	arr = list(map(int, input().split()))
	s = sum(arr) * 5
	s += k[i] * 15
	if s < min:
		min = s
print(min)


n = int(input())
line = input()
o = float('inf')
for _ in range(n):
	cl = 0
	t = 0
	for c in input().split():
		c = int(c)
		cl += 1
		t += c * 5
	t += cl * 15
	o = min(o, t)
print(o)


n = int(input())
pokupateli = list(map(int, input().split()))
ans = 0
x = []
for i in range(n):
	produkti = list(map(int, input().split()))
	for j in range(len(produkti)):
		ans += produkti[j] * 5
	ans += len(produkti) * 15
	x.append(ans)
	ans = 0
print(min(x))


def main():
	n_cashs = int(input())
	n_persons = [int(_) for _ in input().split()]
	result = -1
	for i in range(n_cashs):
		products = [int(_) for _ in input().split()]
		time = sum(products) * 5 + n_persons[i] * 15
		if result == -1 or time < result:
			result = time
	print(result)
main()


n = int(input())
x = list(map(int, input().split()))
(ans, flag) = (0, 0)
for i in range(n):
	a = list(map(int, input().split()))
	if flag == 0:
		ans = sum(a) * 5 + 15 * len(a)
	temp = sum(a) * 5 + 15 * len(a)
	flag += 1
	if ans > temp:
		ans = temp
print(ans)


n = int(input())
string = input()
people = list(map(int, string.split()))
times = []
for x in range(n):
	string = input()
	times.append(sum(map(int, string.split())) * 5 + people[x] * 15)
print(min(times))


n = int(input())
k = list(map(int, input().strip().split()))[:n]
sum = [0] * n
for i in range(0, n):
	arr = list(map(int, input().strip().split()))[:k[i]]
	for j in range(0, k[i]):
		sum[i] += arr[j] * 5
	sum[i] += k[i] * 15
print(min(sum))


n = input()
l = list(map(int, input().split(' ')))
time = 0
m_t = float('inf')
for i in l:
	j = list(map(int, input().split(' ')))
	for k in j:
		time += k * 5 + 15
	if time < m_t:
		m_t = time
	time = 0
print(m_t)


n = int(input())
max = 1000000000000000.0
k = list(map(int, input().split()))
for i in k:
	tot = 0
	m = list(map(int, input().split()))
	for e in m:
		tot += e * 5 + 15
	if max > tot:
		max = tot
print(max)


n = int(input())
people = list(map(int, input().split()))
goods = []
for i in range(n):
	goods += [list(map(int, input().split()))]
time = []
for j in range(n):
	time += [people[j] * 15 + sum(goods[j]) * 5]
print(min(time))


qNumbers = int(input())
k = list(map(int, input().split()))
minScnds = k[0] * 15
itms = list(map(int, input().split()))
for i in range(k[0]):
	minScnds += itms[i] * 5
for i in range(1, qNumbers):
	scnds = k[i] * 15
	itms = list(map(int, input().split()))
	for j in range(k[i]):
		scnds += itms[j] * 5
	minScnds = min(scnds, minScnds)
print(minScnds)


def line_to_cashier(n_int: int, k_list: list, m_list: list) -> int:
	time_list = []
	for i_int in range(n_int):
		people_int = k_list[i_int]
		time_int = 0
		for person in range(people_int):
			time_int += m_list[i_int][person] * 5
			time_int += 15
		time_list.append(time_int)
	return min(time_list)
n = int(input())
k = list(map(int, input().split()))
m = []
for i in range(n):
	m.append(list(map(int, input().split())))
print(line_to_cashier(n, k, m))


n = int(input())
k = input().split()
m = []
scan = 0
for i in range(n):
	m.append(input())
min = 10000000
for j in m:
	a = j.split()
	for h in range(len(a)):
		a[h] = int(a[h])
	s = sum(a) * 5
	time = int(k[m.index(j)]) * 15 + s
	if min > time:
		min = time
print(min)


n = int(input())
k = [int(x) for x in input().split()]
time = []
for i in k:
	ko = [int(x) for x in input().split()]
	time.append(sum([x * 5 + 15 for x in ko]))
print(min(time))


n = int(input())
a = list(map(int, input().split()))
cur_time = min_time = 0
a_len = len(a)
for i in range(a_len):
	k = list(map(int, input().split()))
	cur_time = 0
	cur_time = cur_time + a[i] * 15
	for j in k:
		cur_time = cur_time + j * 5
	if i == 0:
		min_time = cur_time
	elif cur_time < min_time:
		min_time = cur_time
print(min_time)


n = int(input())
arr = list(map(int, input().split()))
lol = []
for i in range(n):
	lol.append(list(map(int, input().split())))
minval = 100000000000000000000
for i in range(n):
	yay = arr[i] * 15
	for j in range(arr[i]):
		yay += 5 * lol[i][j]
	minval = min(minval, yay)
print(minval)


n = int(input())
a = list(map(int, input().split()))
ans = []
for x in range(n):
	sec = 15 * a[x]
	q = list(map(int, input().split()))
	for y in q:
		sec += 5 * y
	ans.append(sec)
print(min(ans))


n = int(input())
k = list(map(int, input().split()))
m = list()
for i in range(n):
	m.append(sum(map(int, input().split())) * 5 + 15 * k[i])
print(min(m))


n = int(input())
l = [int(x) for x in input().split()]
m = 52000
for i in range(n):
	c = [int(x) for x in input().split()]
	s = 0
	for x in c:
		s += x * 5
	s += l[i] * 15
	if s < m:
		m = s
print(m)


import sys
n = int(input())
arr = list(map(int, input().split()))
min1 = sys.maxsize
for i in range(n):
	temp = list(map(int, input().split()))
	temp2 = 0
	temp2 += sum(temp) * 5 + arr[i] * 15
	if min1 > temp2:
		min1 = temp2
print(min1)


try:
	t = int(input())
	m = [int(i) for i in input().split()]
	a = []
	for i in range(t):
		f = [int(i) for i in input().split()]
		a.append(f)
	op = []
	for i in range(t):
		b = sum(a[i]) * 5 + 15 * m[i]
		op.append(b)
	print(min(op))
except:
	pass


n = int(input())
x = [int(x) for x in input().split()]
ans = []
for i in range(n):
	arr = [int(x) for x in input().split()]
	ans.append(sum(arr) * 5 + len(arr) * 15)
print(min(ans))


n = int(input())
k = [int(x) for x in input().split()]
minimum = 100000000000000000000000
for i in range(n):
	m = sum(map(int, input().split())) * 5 + 15 * k[i]
	if m < minimum:
		minimum = m
print(minimum)


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	c = list(map(int, input().split()))
	temp = sum(c) * 5 + a[i] * 15
	b.append(temp)
print(min(b))


a = []
ch = int(input())
cu = list(map(int, input().split()))
for i in range(ch):
	items = list(map(int, input().split()))
	t = sum(items) * 5 + len(items) * 15
	a.append(t)
print(min(a))


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] == 1:
		x = [int(input())]
	else:
		x = list(map(int, input().split()))
	if i == 0:
		m = sum(x) * 5 + a[i] * 15
	else:
		m = min(m, sum(x) * 5 + a[i] * 15)
print(m)


n = int(input())
our_list_1 = list(map(int, input().split()))
our_list_2 = []
for i in range(n):
	our_list_2.append(sum(list(map(int, input().split()))))
our_sum = our_list_2[0] * 5 + 15 * our_list_1[0]
for i in range(n):
	if our_list_2[i] * 5 + 15 * our_list_1[i] < our_sum:
		our_sum = our_list_2[i] * 5 + 15 * our_list_1[i]
print(our_sum)


n = int(input())
no_of_people = list(map(int, input().split()))
T = 10 ** 10
for i in range(n):
	prod = list(map(int, input().split()))
	T = min(T, 15 * len(prod) + sum([5 * x for x in prod]))
print(T)


n = int(input())
k = [int(i) for i in input().split()]
ans = []
for i in range(n):
	m = [int(j) for j in input().split()]
	ans.append(sum(m) * 5 + k[i] * 15)
print(min(ans))


n = int(input())
k = list(map(int, input().split()))
m = [0] * n
time = [0] * n
for i in range(n):
	m[i] = list(map(int, input().split()))
	time[i] = k[i] * 15
	for j in range(len(m[i])):
		time[i] += m[i][j] * 5
print(min(time))


n = int(input())
k = [int(i) for i in input().split()]
min_ = 51501
for i in range(n):
	min_ = min(min_, 15 * k[i] + 5 * sum([int(j) for j in input().split()]))
print(min_)


cashiers = int(input())
peopleByChasier = [int(k) for k in input().split()]
wait = []
for people in range(cashiers):
	waitSec = peopleByChasier[people] * 15
	for i in [int(j) for j in input().split()]:
		waitSec += i * 5
	wait.append(waitSec)
print(min(wait))


n = int(input())
a = list(map(int, input().split()))
min = float('inf')
for i in range(n):
	count = a[i] * 15
	b = list(map(int, input().split()))
	for j in range(a[i]):
		count += b[j] * 5
	if count < min:
		min = count
print(min)


n = int(input())
store = [list(map(int, input().split()))]
x = 0
while x < n:
	s = list(map(int, input().split()))
	items = 0
	for y in s:
		items = items + y
	store.append(items)
	x = x + 1
tmin = 0
for x in range(n):
	time = store[0][x] * 15 + 5 * store[x + 1]
	if x == 0:
		tmin = time
	else:
		tmin = min(tmin, time)
print(tmin)


n = int(input())
best_answer = 999999999
random_numbers = input()
for i in range(n):
	queue = [int(x) for x in input().split(' ')]
	best_answer = min(best_answer, sum(queue) * 5 + len(queue) * 15)
print(best_answer)


N = int(input())
input()
MIN = 10000000
for i in range(N):
	Num = list(map(int, input().split()))
	MIN = min(MIN, sum(Num) * 5 + len(Num) * 15)
print(MIN)


n = int(input())
a = list(map(int, input().split()))
(v, b) = ([], [])
for _ in range(n):
	l = list(map(int, input().split()))
	v.append(sum(l) * 5)
for i in a:
	b.append(i * 15)
z = v[0] + b[0]
for i in range(1, n):
	q = v[i] + b[i]
	z = min(z, q)
print(z)


n = int(input())
arr = list(map(int, input().split(' ')))
z = []
for i in range(n):
	k = list(map(int, input().split(' ')))
	l = len(k)
	s = sum(k)
	x = 15 * l + 5 * s
	z.append(x)
print(min(z))


n = int(input())
a = list(map(int, input().split()))
c = []
for i in range(n):
	l = list(map(int, input().split()))
	s = 0
	for j in range(len(l)):
		s += l[j] * 5
		z = j
	s += (z + 1) * 15
	c.append(s)
print(min(c))


c = int(input())
q = list(map(int, input().split()))
j = []
s = 0
ans = 999999999999999999
for i in range(c):
	j = [int(x) * 5 for x in input().split()]
	s = sum(j) + len(j) * 15
	ans = min(ans, s)
print(ans)


_ = int(input())
__ = list(map(int, input().split()))
_1_ = []
for ___ in range(len(__)):
	____ = list(map(int, input().split()))
	_____ = len(____) * 15
	for ______ in range(len(____)):
		_____ += 5 * ____[______]
	_1_.append(_____)
print(min(_1_))


n = int(input())
l = list(map(int, input().split()))
emp = []
for i in range(n):
	a = list(map(int, input().split()))
	p = sum(a) * 5 + l[i] * 15
	emp.append(p)
print(min(emp))


n = int(input())
lis = list(map(int, input().split()))
ans = 1e+18
for i in lis:
	tmp = list(map(int, input().split()))
	totalTime = 0
	for j in tmp:
		totalTime += j * 5
	totalTime += len(tmp) * 15
	if min(ans, totalTime) == totalTime:
		ans = totalTime
print(ans)


n = int(input())
arr = list(map(int, input().split()))
lst = []
for x in range(n):
	mrr = list(map(int, input().split()))
	count = 0
	for ele in mrr:
		count += ele * 5
	count += 15 * len(mrr)
	lst.append(count)
print(min(lst))


nb_cashier = int(input())
peoples = [int(x) for x in input().split()]
mins = int(1000000.0)
for i in range(nb_cashier):
	curr = sum([int(x) * 5 for x in input().split()])
	curr += peoples[i] * 15
	mins = min(mins, curr)
print(mins)


import fileinput

def test():
	pass
for arg in range(2):
	if arg == 0:
		n = int(input())
	else:
		queue = input().split()
lines = {}
for i in range(n):
	lines[i] = input().split()
wait_times = {}
for ln in lines:
	for el in lines[ln]:
		if ln in wait_times:
			wait_times[ln] += int(el) * 5
		else:
			wait_times[ln] = int(el) * 5
for ln in lines:
	wait_times[ln] += len(lines[ln]) * 15
print(wait_times[min(wait_times, key=wait_times.get)])


n = int(input())
k = list(map(int, input().split()))
res = 2000000000.0
for i in range(n):
	arr = list(map(int, input().split()))
	res = min(res, sum(arr) * 5 + 15 * len(arr))
print(res)


n = int(input())
l = list(map(int, input().split()))
c = [15 * l[i] + sum(list(map(int, input().split()))) * 5 for i in range(n)]
print(min(c))


n = int(input())
hugatsa = []
b = list(map(int, input().strip().split()))
for i in range(0, n):
	a = list(map(int, input().strip().split()))
	k = sum(a) * 5 + len(a) * 15
	hugatsa.append(k)
print(min(hugatsa))


n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(0, n):
	b = list(map(int, input().split()))
	c = sum(b)
	d = 5 * c + 15 * len(b)
	x.append(d)
c = min(x)
print(c)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
n = int(input())
cust = list(map(int, input().split()))
lines = []
for i in range(n):
	lines.append(list(map(int, input().split())))
min_time = sum(list(map(lambda x: x * 5, lines[0]))) + cust[0] * 15
for line in lines:
	time = sum(list(map(lambda x: x * 5, line))) + len(line) * 15
	if time < min_time:
		min_time = time
print(min_time)


n = map(int, input().split())
l = list(map(int, input().split()))
ans = 11 ** 11
for nn in l:
	ll = list(map(int, input().split()))
	t = 15 * nn
	for x in ll:
		t += 5 * x
	if t < ans:
		ans = t
print(ans)


n = int(input())
input()
curMin = None
for i in range(n):
	A = list(map(int, input().split()))
	t = 15 * len(A) + sum(A) * 5
	if not curMin:
		curMin = t
	else:
		curMin = min(curMin, t)
print(curMin)


n = int(input())
ks = [int(i) for i in input().split()]
mi = 10 ** 9
for k in range(n):
	mi = min(mi, sum([5 * int(i) + 15 for i in input().split()]))
print(mi)


n = int(input())
temp = [int(x) for x in input().split()]
slon = 9999999999999999
for i in range(n):
	temp2 = [int(x) for x in input().split()]
	t = 0
	for j in range(temp[i]):
		t += temp2[j] * 5
		t += 15
	slon = min(slon, t)
print(slon)


n = int(input())
s = list(map(int, input().split()))
t = []
for j in range(n):
	p = list(map(int, input().split()))
	t.append(len(p) * 15 + sum(p) * 5)
print(min(t))


n = int(input())
k = list(map(int, input().split()))
l = []
for i in range(n):
	l1 = list(map(int, input().split()))
	l.append(l1)
a = []
for i in range(n):
	l[i] = list(map(lambda i: i * 5, l[i]))
	a.append(sum(l[i]) + 15 * len(l[i]))
print(min(a))


n = int(input())
li = list(map(int, input().split()))
ki = []
k = 0
for i in range(n):
	cv = sum(list(map(int, input().split()))) * 5
	ki.append(cv + li[k] * 15)
	k += 1
print(min(ki))


kasses = int(input())
sizes = list(map(int, input().split()))
ocheredi = []
for i in range(kasses):
	ocheredi.append(list(map(int, input().split())))
m = -1
for i in ocheredi:
	cm = 15 * len(i)
	for j in i:
		cm += 5 * j
	if cm < m or m == -1:
		m = cm
print(m)


n = int(input())
queues = list(map(int, input().split()))
mns = [None] * n
for num in range(n):
	mns[num] = list(map(int, input().split()))
times = [None] * n
for num in range(n):
	time = 0
	for i in range(queues[num]):
		time += mns[num][i] * 5 + 15
	times[num] = time
print(min(times))


import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
ans = 10 ** 9
for test in range(n):
	l = [int(i) for i in input().split()]
	ans = min(sum(l) * 5 + len(l) * 15, ans)
print(ans)


n = int(input())
k = list(map(int, input().split()))
a = []
m = 0
for i in range(n):
	b = list(map(int, input().split()))
	if len(b) == 1:
		m = b[0] * 5 + 15
	else:
		for j in range(k[i]):
			m += b[j] * 5
		m += (j + 1) * 15
	a.append(m)
	m = 0
print(min(a))


n = int(input())
ans = list(map(int, input().split()))
ans = [i * 15 for i in ans]
for i in range(n):
	ans[i] += sum(list(map(int, input().split()))) * 5
print(min(ans))


n = int(input())
q_cnt = list(map(int, input().split()))
i_cnt = [list(map(int, input().split())) for i in range(n)]
print(min((sum(i_cnt[i]) * 5 + q_cnt[i] * 15 for i in range(n))))


n = int(input())
k = list(map(int, input().split()))
ans = 10 ** 9
for i in range(n):
	m = list(map(int, input().split()))
	ans = min(ans, 15 * len(m) + 5 * sum(m))
print(ans)


n = int(input())
m = list(map(int, input().split()))
i = 0
a = []
while i < n:
	b = list(map(int, input().split()))
	j = len(b) * 15
	for p in b:
		j += p * 5
	a.append(j)
	i += 1
a.sort()
print(a[0])


n = int(input())
k = input()
r = 100000000000000000000
for i in range(n):
	d = list(map(int, input().split(' ')))
	s = len(d) * 15 + sum(d) * 5
	if s < r:
		r = s
print(r)


I = lambda : int(input())
IL = lambda : list(map(int, input().split()))
n = I()
K = IL()
ans = []
for k in K:
	M = IL()
	ans.append(len(M) * 15 + sum(M) * 5)
print(min(ans))


n = int(input())
k = list(input().split(' '))
k = list((int(x) for x in k))
ans = int(10000000000000.0)
for i in range(n):
	loc = list(input().split(' '))
	loc = list((int(x) for x in loc))
	res = sum(loc) * 5 + len(loc) * 15
	ans = min(ans, res)
print(ans)


import math
n = int(input())
mi = math.inf
l = list(map(int, input().split()))
m = []
for i in range(n):
	m = list(map(int, input().split()))
	mi = min(mi, sum(m) * 5 + len(m) * 15)
print(mi)


n = int(input())
a = [0] * n
d = [0] * n
k = list(map(int, input().split()))
for i in range(n):
	x = list(map(int, input().split()))
	s = len(x)
	d[i] = sum(x) * 5 + s * 15
print(min(d))


ans = []
a = 0
s = 0
for _ in range(int(input()) + 1):
	l = list(map(int, input().split()))
	a += sum(l) * 5
	a += len(l) * 15
	if s == 0:
		s = a
		a = 0
	else:
		ans.append(a)
		a = 0
ans.sort()
print(min(ans))


n = int(input())
k = [int(i) for i in input().split()]
tms = []
for i in range(n):
	m = [int(i) for i in input().split()]
	tgens = k[i]
	tm1 = 0
	tm1 += 15 * tgens
	sm = sum(m) * 5
	tm1 += sm
	tms.append(tm1)
print(min(tms))


chasiers = int(input())
queus = list(map(int, input().split()))
array = []
for i in range(len(queus)):
	l = list(map(int, input().split()))[:queus[i]]
	array.append(sum(l) * 5 + 15 * len(l))
print(min(array))


import itertools

def main():
	n = int(input())
	c = [int(v) for v in input().split()]
	mv = 100000000000000
	r = 0
	for i in range(n):
		data = [int(v) for v in input().split()]
		res = c[i] * 15 + sum([5 * v for v in data])
		mv = min(res, mv)
	print(mv)
main()


n = int(input())
m = list(map(int, input().split()))
time = []
products = []
for i in range(len(m)):
	products += [list(map(int, input().split()))]
for i in products:
	time += [15 * len(i) + sum(i) * 5]
print(min(time))


n = int(input())
a = list(map(int, input().split()))
b = list()
for i in range(len(a)):
	b.append(list(map(int, input().split())))
c = []
for i in range(len(a)):
	k = 0
	for item in b[i]:
		k = k + 5 * item
	k = k + a[i] * 15
	c.append(k)
print(min(c))


n = int(input())
r = lambda : list(map(int, input().split()))
arr = r()
ans = float('inf')
for i in range(n):
	x = r()
	c = sum(x) * 5 + 15 * len(x)
	ans = min(ans, c)
print(ans)


n = int(input())
l = list(map(int, input().split()))
ans = pow(10, 9)
for i in range(n):
	ans = min(ans, l[i] * 15 + sum(list(map(int, input().split()))) * 5)
print(ans)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = iinput()
a = list(map(int, input().split()))
h = []
for i in range(n):
	s = list(map(int, input().split()))
	count = 0
	for i in range(len(s)):
		count += s[i] * 5
	count += len(s) * 15
	h.append(count)
print(min(h))


R = lambda : list(map(int, input().split()))
n = int(input())
l = R()
print(min([sum(R()) * 5 + 15 * l[i] for i in range(n)]))


n = int(input())
customers = list(map(int, input().split()))
mat = []
for i in range(n):
	mat.append(list(map(int, input().split())))
min = float('inf')
for i in range(len(mat)):
	currenttot = sum(mat[i]) * 5 + customers[i] * 15
	if currenttot < min:
		min = currenttot
print(min)


n = int(input())
k = list(map(int, input().rstrip().split()))
mat = []
for i in range(n):
	a = list(map(int, input().rstrip().split()))
	mat += [sum(a) * 5 + k[i] * 15]
print(min(mat))


from collections import Counter

def solve():
	n = int(input())
	queue = [int(i) for i in input().split()]
	(Min, sum) = (10 ** 6, 0)
	for i in range(n):
		arr = [int(i) for i in input().split()]
		sum = 15 * queue[i]
		for i in arr:
			sum += i * 5
		Min = min(sum, Min)
	return Min
print(solve())


n = int(input())
ans = float('inf')
input()
for i in range(n):
	line = list(map(int, input().split()))
	tm = sum(line) * 5 + len(line) * 15
	ans = min(ans, tm)
print(ans)


n = int(input())
m = 1000000
z = list(map(int, input().split()))
for j in range(n):
	li = list(map(int, input().split()))
	x = 0
	for i in li:
		x += i * 5
		x += 15
	m = min(m, x)
print(m)


x = int(input())
a = list(map(int, input().split()))
t = []
for i in range(len(a)):
	a1 = list(map(int, input().split()))
	t.append(sum(a1) * 5 + len(a1) * 15)
print(min(t))


n = int(input())
k = input()
l = []
mini = 1000000000.0
for i in range(n):
	l.append(list(map(int, input().split(' '))))
	mini = min(mini, sum(l[i]) * 5 + len(l[i]) * 15)
print(mini)


n = int(input())
k = list(map(int, input().split()))
mat = []
for i in range(n):
	l = list(map(int, input().split()))
	mat.append(l)
res = []
temp = 0
for i in range(n):
	t = k[i]
	demo = 0
	for j in range(t):
		demo = demo + mat[i][j]
	demo = demo * 5
	demo += t * 15
	res.append(demo)
print(min(res))


def int_map(i=None):
	if not i:
		i = input()
	return map(int, i.split(' '))
n = int(input())
t = [0] * n
if n == 1:
	p = [int(input())]
else:
	p = list(int_map())
for (num, i) in enumerate(p):
	if i == 1:
		b = [int(input())]
	else:
		b = list(int_map())
	for j in b:
		t[num] += j * 5 + 15
print(min(t))


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	l = list(map(int, input().split()))
	b.append(sum(l) * 5 + 15 * len(l))
print(min(b))


x = int(input())
n = list()
p = list(map(int, input().split()))
for i in range(x):
	k = list(map(int, input().split()))
	n.append(sum(k) * 5 + len(k) * 15)
print(min(n))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
counter = get_int_list()
counter_time = [0] * n
for i in range(n):
	counter_time[i] = sum(get_int_list()) * 5 + counter[i] * 15
print(min(counter_time))


n = int(input())
l = list(map(int, input().split()))
max = 1000000000000000000000000
for i in range(n):
	li = list(map(int, input().split()))
	s = 15 * len(li)
	for j in li:
		s += 5 * j
	if s < max:
		max = s
print(max)


def main():
	input()
	mi = int(100000000.0)
	for _ in list(map(int, input().split(' '))):
		m = list(map(int, input().split(' ')))
		mi = min(mi, len(m) * 15 + sum(list(map(lambda i: i * 5, m))))
	return mi
print(main())


bot = True
n = int(input())
input()
print(min((sum((5 * y + 15 for y in x)) for x in (map(int, input().split()) for _ in range(n)))))


n = int(input())
map(int, input().split())
person = []
for i in range(n):
	tmp = list(map(int, input().split()))
	q = len(tmp) * 15
	v = sum(tmp) * 5
	person.append(q + v)
print(min(person))


N = int(input())
kassa = list(map(int, input().split()))
i = 0
people = list([0] * N)
while i != N:
	people[i] = list(map(int, input().split()))
	i += 1
min_sec = 100000000000
for human in people:
	sec = 0
	for tovar in human:
		sec += tovar * 5 + 15
	if min_sec > sec:
		min_sec = sec
print(min_sec)


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
m = sum(b) * 5 + a[0] * 15
for i in range(1, n):
	b = [int(i) for i in input().split()]
	if sum(b) * 5 + a[i] * 15 < m:
		m = sum(b) * 5 + a[i] * 15
print(m)


n = int(input())
k = [int(i) for i in input().split()]
m = []
for i in range(n):
	m.append([int(j) for j in input().split()])
t = [0] * n
for i in range(n):
	t[i] = sum(m[i]) * 5 + len(m[i]) * 15
print(min(t))


n = int(input())
a = [int(i) for i in input().split()]
ans = 100000000
for j in range(n):
	b = [int(i) for i in input().split()]
	ans = min(ans, sum(b) * 5 + 15 * a[j])
print(ans)


n = int(input())
ar = list(map(int, input().split()))
ans = []
for i in range(0, n):
	k = ar[i]
	arr = list(map(int, input().split()))[:k]
	s = sum(arr) * 5 + 15 * k
	ans.append(s)
print(min(ans))


import math
n = int(input())
a = []
a = list(map(int, input().strip().split()))
m = 10000000
s = 0
for i in range(n):
	x = []
	x = list(map(int, input().strip().split()))
	s = 0
	s = sum(x) * 5 + len(x) * 15
	m = min(m, s)
print(m)


n = int(input())
k = [int(x) for x in input().split()]
ans = 10 ** 10
for i in range(n):
	ans = min(ans, sum((int(x) for x in input().split())) * 5 + k[i] * 15)
print(ans)


def f(l):
	return sum(l) * 5 + 15 * len(l)
n = int(input())
_ = input()
lista = [list(map(int, input().split())) for i in range(n)]
time = list(map(f, lista))
print(min(time))


cases = int(input())
arr = list(map(int, input().split()))
i = 0
mn = float('inf')
while cases:
	cases -= 1
	minute = sum(map(int, input().split())) * 5
	mn = min(minute + arr[i] * 15, mn)
	i += 1
print(mn)


n = int(input())
k = list(map(int, input().split()))
m = []
for i in range(n):
	m.append(list(map(int, input().split())))
least_time = None
for i in range(n):
	if least_time == None or least_time > sum(m[i]) * 5 + k[i] * 15:
		least_time = sum(m[i]) * 5 + k[i] * 15
print(least_time)


n = int(input())
k = list(map(int, input().split()))
t = 999999999
for i in range(n):
	curt = 15 * k[i] + 5 * sum([x for x in map(int, input().split())])
	if curt < t:
		t = curt
print(t)


import math
n = int(input())
k = list(map(int, input().split()))
sum1 = math.inf
for i in range(n):
	sum2 = 0
	m = list(map(int, input().split()))
	sum2 += sum(m) * 5
	sum2 += len(m) * 15
	sum1 = min(sum1, sum2)
print(sum1)


n = int(input())
ans = 100000000
Customers = list(map(int, input().split()))
for i in range(n):
	L = list(map(int, input().split()))
	time = Customers[i] * 15 + 5 * sum(L)
	ans = min(time, ans)
print(ans)


n = int(input())
l = list(map(int, input().split()))
m = 2 ** 31
for i in range(n):
	a = list(map(int, input().split()))
	x = 15 * l[i] + 5 * sum(a)
	m = min(m, x)
print(m)


n = int(input())
k = map(int, input().split())
r = 51500
for i in range(n):
	m = list(map(int, input().split()))
	p = len(m) * 15 + 5 * sum(m)
	r = min(r, p)
print(r)


l2 = []
n = int(input())
s = input()
for i in range(n):
	l = list(map(int, input().split()))
	l = list(map(lambda x: x * 5 + 15, l))
	l2.append(sum(l))
print(min(l2))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def getTimeOfLine(customers):
	return sum(list(map(lambda x: x * 5, customers))) + len(customers) * 15
n = int(input())
cust = list(map(int, input().split()))
lines = []
for i in range(n):
	lines.append(list(map(int, input().split())))
min_time = getTimeOfLine(lines[0])
for line in lines:
	time = getTimeOfLine(line)
	min_time = min(min_time, time)
print(min_time)


R = lambda : map(int, input().split())
(n,) = R()
print(min((15 * k + 5 * sum(R()) for k in R())))


n = int(input())
k = list(map(int, input().split()))
ans = 1000000000
for i in range(n):
	m = list(map(int, input().split()))
	s = 0
	for i in m:
		s += i * 5 + 15
	ans = min(ans, s)
print(ans)


n = int(input())
input()
ans = 100000
for _ in range(n):
	m = map(int, input().split())
	cur = 0
	for x in m:
		cur += 5 * x + 15
	ans = min(ans, cur)
print(ans)


class CodeforcesTask408ASolution:

	def __init__(self):
		self.result = ''
		self.cash_count = 0
		self.client_cashwise = []
		self.baskets = []

	def read_input(self):
		self.cash_count = int(input())
		self.client_cashwise = [int(x) for x in input().split(' ')]
		for x in range(self.cash_count):
			self.baskets.append([int(x) for x in input().split(' ')])

	def process_task(self):
		times = [len(x) * 15 + 5 * sum(x) for x in self.baskets]
		self.result = str(min(times))

	def get_result(self):
		return self.result
Solution = CodeforcesTask408ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input(''))
s = input('')
l = s.split(' ')
l = list(map(int, l))
l2 = []
for i in range(n):
	s1 = input('')
	l1 = s1.split(' ')
	l1 = list(map(int, l1))
	val = sum(l1) * 5 + l[i] * 15
	l2.append(val)
print(min(l2))


n = int(input())
s = input()
k = [int(i) for i in s.split()]
mmin = 2 ** 31 - 1
for i in range(n):
	s = input()
	inp = [int(i) for i in s.split()]
	tmp = sum(inp) * 5 + 15 * k[i]
	mmin = min(mmin, tmp)
print(mmin)


n = int(input())
q = [int(x) for x in input().split()]
c = []
t = []
for i in range(n):
	c.append([int(x) for x in input().split()])
for i in range(n):
	ans = 0
	for e in range(q[i]):
		ans += 5 * c[i][e]
		ans += 15
	t.append(ans)
print(min(t))


t = int(input())
p = []
k = list(map(int, input().split()))
for i in range(0, t):
	a = list(map(int, input().split()))
	s = sum(a) * 5 + len(a) * 15
	p.append(s)
print(min(p))


n = int(input())
k = list(map(int, input().split()))
empty = []
for i in range(n):
	k1 = list(map(int, input().split()))
	sum = 0
	for j in k1:
		sum += 15 + j * 5
	empty.append(sum)
empty.sort()
print(empty[0])


def count_time():
	p = list(map(int, input().split()))
	d = 0
	for i in p:
		d += i * 5 + 15
	return d
n = int(input())
k = list(map(int, input().split()))
f = []
for i in range(n):
	f += [count_time()]
print(min(f))


k = int(input())
a = list(map(int, input().split()))
min1 = 999999
for _ in range(k):
	k = list(map(int, input().split()))
	sum1 = sum([x * 5 for x in k]) + len(k) * 15
	if sum1 < min1:
		min1 = sum1
print(min1)


num_cashiers = int(input())
queue_sizes = list(map(lambda x: int(x) * 15, input().split()))
items = []
for i in range(num_cashiers):
	items_list = sum(map(lambda x: int(x) * 5, input().split()))
	items.append(items_list)
min_time = min((change + groceries for (change, groceries) in zip(queue_sizes, items)))
print(min_time)


n = int(input())
l = list(map(int, input().split()))
l1 = []
for i in range(n):
	time = 0
	lin = list(map(int, input().split()))
	for j in lin:
		time += j * 5
	time += l[i] * 15
	l1.append(time)
print(min(l1))


n = int(input())
a = [0 for i in range(n)]
ar = input().split()
for i in range(n):
	a[i] = int(ar[i]) * 15
for j in range(n):
	m = map(int, input().split())
	for k in m:
		a[j] += k * 5
mine = 100 * 100 * 5 + 15 * 100 + 1
for j in range(n):
	mine = min(mine, a[j])
print(mine)


n = int(input())
persons = list(map(int, input().split()))
groceries = list()
for i in range(len(persons)):
	gro = list(map(int, input().split()))
	groceries.append(gro)
Min = 0
for i in range(len(persons)):
	if i == 0:
		Min = 5 * sum(groceries[i]) + 15 * len(groceries[i])
	elif Min >= 5 * sum(groceries[i]) + 15 * len(groceries[i]):
		Min = 5 * sum(groceries[i]) + 15 * len(groceries[i])
print(Min)


n = int(input())
a = [int(i) for i in input().split()]
l = []
for i in range(n):
	b = [int(i) for i in input().split()]
	sum = 0
	for j in range(0, len(b)):
		sum = sum + b[j] * 5
	sum = sum + 15 * len(b)
	l.append(sum)
print(min(l))


def kassa(lst):
	d = list()
	for elem in lst:
		d.append(sum(elem * 5) + len(elem) * 15)
	return min(d)
n = int(input())
a = [int(i) for i in input().split()]
b = list()
for j in range(n):
	z = [int(x) for x in input().split()]
	b.append(z)
print(kassa(b))


n = int(input())
numPeople = list(map(int, input().split()))
lines = [list(map(int, input().split())) for n in range(0, n)]
minTime = -1
for i in range(0, n):
	time = 0
	for j in range(0, numPeople[i]):
		time += 15
		time += lines[i][j] * 5
	if minTime is -1:
		minTime = time
	elif minTime > time:
		minTime = time
print(minTime)


n = int(input())
c = [int(i) for i in input().split()]
t = []
for i in range(n):
	t.append(sum([int(i) for i in input().split()]) * 5 + c[i] * 15)
print(min(t))


n = int(input())
l = [int(i) for i in input().split()]
m = [[int(i) for i in input().split()] for i in range(n)]
p = []
for i in m:
	s = 0
	for j in range(len(i)):
		s += i[j] * 5 + 15
	p.append(s)
print(min(p))


n = int(input())

def read():
	return list(map(int, input().split()))
k = read()
print(min((sum(read()) * 5 + k[i] * 15 for i in range(0, n))))


n = int(input())
k = list(map(int, input().split()))
m = 10000000000
for _ in range(n):
	p = list(map(int, input().split()))
	m = min(m, 5 * sum(p) + 15 * len(p))
print(m)


i = lambda : [*map(int, input().split())]
n = i()[0]
k = i()
print(min((k[l] * 15 + sum(i()) * 5 for l in range(n))))


n = int(input())
sumi = []
x = list(map(int, input().split()))
for j in range(n):
	sumi = sumi + [5 * sum(list(map(int, input().split()))) + 15 * x[j]]
print(min(sumi))


n = int(input())
k = [int(x) for x in input().split()]
j = []
wait = []
for i in range(n):
	j.append([int(x) for x in input().split()])
	wait.append(sum(j[i]) * 5 + k[i] * 15)
print(min(wait))


(n, k) = (int(input()), list(map(int, input().split())))
w = []
for i in range(n):
	m = list(map(int, input().split()))
	f = k[i]
	tm1 = 0
	tm1 += 15 * f
	sm = sum(m) * 5
	tm1 += sm
	w.append(tm1)
print(min(w))


n = int(input())
k = list(map(int, input().split()))
price = 10
for i in range(0, n):
	lis = list(map(int, input().split()))
	total = k[i] * 15
	for j in lis:
		total = total + j * 5
	if price == 10:
		price = total
	if price > total:
		price = total
print(price)


n = int(input())
q = [int(x) for x in input().split()][:n]
arr = []
for i in q:
	x = [int(j) for j in input().split()][:i]
	arr.append(sum(x) * 5 + i * 15)
print(min(arr))


n = int(input())
m = []
arr = [int(i) for i in input().split()]
for i in range(n):
	s = 0
	l = [int(z) for z in input().split()]
	s = sum(l) * 5 + len(l) * 15
	m.append(s)
print(min(m))


god = 10 ** 18
x = int(input())
items = list(map(int, input().split(' ')))
for i in range(x):
	a = list(map(int, input().split(' ')))
	god = min(god, sum(a) * 5 + 15 * items[i])
print(god)


alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
k = list(map(int, input().split()))
E = 10 ** 9
for i in range(n):
	m = list(map(int, input().split()))
	p = sum(m) * 5 + k[i] * 15
	E = min(E, p)
print(E)


from functools import reduce
n = int(input())
l = [int(x) for x in input().split()]
min_time = 10 ** 9
for _ in range(n):
	ques = [int(x) for x in input().split()]
	currsum = reduce(lambda x, y: x + y * 5 + 15, ques) + 15 + ques[0] * 4
	min_time = min(min_time, currsum)
print(min_time)


n = int(input())
l = list(map(int, input().split()))
b = 99999999
for i in range(n):
	a = list(map(int, input().split()))
	if b > sum(a) * 5 + len(a) * 15:
		b = sum(a) * 5 + len(a) * 15
print(b)


n = int(input())
k = [int(x) for x in input().split(' ')]
m = [[int(x) for x in input().split(' ')] for cashier in range(n)]
ans = min([15 * len(z) + 5 * sum(z) for z in m])
print(ans)


n = int(input())
l = list(map(int, input().split()))
ans = float('inf')
for i in range(n):
	Sum = sum((i * 5 for i in list(map(int, input().split())))) + l[i] * 15
	if ans > Sum:
		ans = Sum
print(ans)


no_of_cashiers = int(input())
queues = list(map(int, input().split(' ')))

def calculateTime(item):
	return item * 5 + 15
time_taken = []
for i in range(no_of_cashiers):
	items = list(map(int, input().split(' ')))
	time_taken.append(sum([calculateTime(i) for i in items]))
print(min(time_taken))


n = int(input())
ppl = list(map(int, input().split()))
ans = 10 ** 8
for i in range(n):
	items = list(map(int, input().split()))
	time = 0
	for i in items:
		time += i * 5 + 15
	ans = min(ans, time)
print(ans)


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
ls = lambda : list(input().strip())
from collections import defaultdict as df
import heapq
infinite = float('inf')
n = int(input())
l = RI()
l = [[] for i in range(n)]
for i in range(n):
	l[i] = RI()
mini = 1000000000
for i in range(n):
	temp = sum(l[i])
	temp *= 5
	temp += len(l[i]) * 15
	mini = min(mini, temp)
print(mini)


n = int(input())
k = list(map(int, input().split()))
now = 0
m = 100000000
for i in range(n):
	b = map(int, input().split())
	now = 0
	for j in b:
		now += j * 5 + 15
	m = min(m, now)
print(m)


n = int(input())
l = list(map(int, input().split()))
w = []
for i in range(n):
	p = list(map(int, input().split()))
	s = sum(p) * 5
	w.append(s)
t = []
for i in range(n):
	m = l[i] * 15 + w[i]
	t.append(m)
print(min(t))


n = int(input())
lst = list(map(int, input().split()))
val = 10000005
for i in range(n):
	val = min(val, sum(map(int, input().split())) * 5 + lst[i] * 15)
print(val)


n = int(input())
l1 = list(map(int, input().split()))
k = []
for j in range(n):
	sum = 0
	l = list(map(int, input().split()))
	for i in range(len(l)):
		sum = l[i] * 5 + sum
	sum = l1[j] * 15 + sum
	k.append(sum)
print(min(k))


n = int(input())
k = list(map(int, input().split()))
m = []
for i in range(n):
	m.append(list(map(int, input().split())))
k = 0
f = []
for i in m:
	for j in range(len(i)):
		k = k + i[j] * 5 + 15
	f.append(k)
	k = 0
a = min(f)
print(a)


n = int(input())
array = []
a = []
for i in range(n + 1):
	array.append(list(map(int, input().split())))
for i in range(1, n + 1):
	a.append(sum(array[i]) * 5 + array[0][i - 1] * 15)
print(min(a))


def line_to_cashier(arr, b):
	min = 10000000000
	for i in range(len(arr)):
		tp = arr[i] * 15
		sum_array = sum(b[i]) * 5
		total = tp + sum_array
		if total < min:
			final_ans = total
			min = total
	print(final_ans)
n = int(input(''))
arr = list(map(int, input('').split()))
b = []
for i in range(n):
	a = list(map(int, input('').split()))
	b.append(a)
line_to_cashier(arr, b)


n = int(input())
l1 = [int(i) for i in input().split()]
m = 10000001
for i in range(n):
	l = [int(i) for i in input().split()]
	m = min(m, sum(l) * 5 + l1[i] * 15)
print(m)


import re
import inspect
from sys import argv, exit

def rstr():
	return input()

def rstrs(splitchar=' '):
	return [i for i in input().split(splitchar)]

def rint():
	return int(input())

def rints(splitchar=' '):
	return [int(i) for i in rstrs(splitchar)]

def varnames(obj, namespace=globals()):
	return [name for name in namespace if namespace[name] is obj]

def pvar(var, override=False):
	prnt(varnames(var), var)

def prnt(*args, override=False):
	if '-v' in argv or override:
		print(*args)
pq = []

def penq(s):
	if not isinstance(s, str):
		s = str(s)
	pq.append(s)

def pdump():
	s = '\n'.join(pq).encode()
	os.write(1, s)
n = rint()
qs = rints()
lines = [[i * 5 for i in rints()] for i in range(n)]
ans_lines = [len(l) * 15 + sum(l) for l in lines]
print(min(ans_lines))


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
mini = inf
for i in range(n):
	Arr = get_array()
	time = sum(Arr) * 5 + len(Arr) * 15
	if time < mini:
		mini = time
print(mini)


def main():
	input()
	print(min((k * 3 + sum(map(int, input().split())) for k in map(int, input().split()))) * 5)
main()


from math import inf
n = int(input().strip())
cus_num = list(map(int, input().strip().split()))
min_time = inf
for i in range(n):
	lst = list(map(int, input().strip().split()))
	time = cus_num[i] * 15 + sum(lst) * 5
	min_time = min(min_time, time)
print(min_time)


n = int(input())
l = []
m = [int(x) for x in input().split()]
for x in range(n):
	a = [int(x) for x in input().split()]
	b = sum(a) * 5 + m[x] * 15
	l.append(b)
print(min(l))


import sys
import math
n = int(sys.stdin.readline())
kn = [int(x) for x in sys.stdin.readline().split()]
vmin = 51501
for i in range(n):
	t = kn[i] * 15 + sum([int(x) for x in sys.stdin.readline().split()]) * 5
	if t < vmin:
		vmin = t
print(vmin)


n = int(input())
k = list(map(int, input().split()))
minn = 10000000000000
for i in range(n):
	m = list(map(int, input().split()))
	if sum(m) * 5 + 15 * k[i] < minn:
		minn = sum(m) * 5 + 15 * k[i]
print(minn)


import sys
n = int(input())
l = list(map(int, input().split()))
minm = sys.maxsize
for i in range(n):
	l1 = list(map(int, input().split()))
	summ = sum(l1)
	t = summ * 5 + l[i] * 15
	minm = min(minm, t)
print(minm)


n = int(input())
size = [int(i) for i in input().split()]
m = []
for i in range(0, n):
	m.append([])
	m[i] = [int(j) for j in input().split()]
ans = [i * 15 for i in size]
for i in range(0, n):
	sum = 0
	for j in m[i]:
		sum = sum + j * 5
	ans[i] = ans[i] + sum
min = ans[0]
for i in ans:
	if i < min:
		min = i
print(min)


n = int(input())
ans = 1000000000000
l1 = list(map(int, input().split()))
for i in range(n):
	l1 = list(map(int, input().split()))
	ans = min(sum(l1) * 5 + 15 * len(l1), ans)
print(ans)


a = int(input())
k = list(map(int, input().split()))
c = []
for i in range(a):
	d = list(map(int, input().split()))
	c.append(5 * sum(d) + 15 * len(d))
print(min(c))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def solve():
	min_ans = int(1e+18)
	n = readint()
	arr = readarri()
	for _ in range(n):
		tarr = readarri()
		sm = arr[_] * 15 + sum((5 * i for i in tarr))
		min_ans = min(min_ans, sm)
	print(min_ans)

def main():
	t = 1
	for _ in range(t):
		solve()
main()


n = int(input())
x = [int(i) for i in input().split()]
res = []
for i in range(n):
	e = [i * 5 for i in map(int, input().split())]
	res.append(sum(e) + x[i] * 15)
print(min(res))


n = int(input())
l = list(map(int, input().split()))
z = []
for i in range(n):
	a = list(map(int, input().split()))
	sum = 0
	for j in a:
		sum += j * 5 + 15
	z.append(sum)
print(min(z))


def calculator(men, buying):
	result = 0
	result += sum(buying) * 5
	result += men * 15
	return result

def main():
	pay_desks = int(input())
	queue = list(map(int, input().split()))
	temporal = 0
	amount = calculator(queue[0], list(map(int, input().split())))
	for i in range(1, pay_desks):
		temporal = calculator(queue[i], list(map(int, input().split())))
		if temporal < amount:
			amount = temporal
	print(amount)
main()


n = int(input())
l = list(map(int, input().split()))
o = []
for i in range(n):
	count = 0
	p = list(map(int, input().split()))
	for i in p:
		count += i * 5
	o.append(count + len(p) * 15)
print(min(o))


n = int(input())
a = [int(x) for x in input().split()]
min = 99999999
for i in range(n):
	b = [int(x) for x in input().split()]
	sum = 0
	for x in b:
		sum += x
	cost = sum * 5 + a[i] * 15
	if min > cost:
		min = cost
print(min)


n = int(input())
k = list(map(int, input().split()))
m = []
for i in range(n):
	m.append(list(map(int, input().split())))
mi = 1000 * 1000 + 1
for i in range(n):
	s = 0
	for j in range(k[i]):
		s += m[i][j] * 5 + 15
	if k[i] == 0:
		s = 0
	mi = min(mi, s)
print(mi)


import math
n = int(input())
k = input().split()
k = [int(i) for i in k]
min_time = math.inf
scan_time = 5
add_time = 15
for i in range(0, n):
	m = input().split()
	m = [int(j) for j in m]
	curr_time = 0
	for j in m:
		curr_time += j * scan_time
		curr_time += add_time
	if curr_time < min_time:
		min_time = curr_time
print(min_time)


import sys
from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt, gcd

def ip():
	return int(sys.stdin.readline())

def sip():
	return sys.stdin.readline()

def mip():
	return map(int, sys.stdin.readline().split())

def mips():
	return map(str, sys.stdin.readline().split())

def lip():
	return list(map(int, sys.stdin.readline().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.insert(i, arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
n = ip()
arr = lip()
count = 10 ** 6
for i in range(n):
	p = lip()
	p_sum = sum(p)
	p_sum *= 5
	p_sum += arr[i] * 15
	count = min(count, p_sum)
print(count)


n = int(input())
k = list(map(int, input().split()))
arr = [list(map(int, input().split())) for _ in range(n)]
kek = []
for i in range(n):
	kek.append(0)
	kek[i] += k[i] * 15
	for x in arr[i]:
		kek[i] += x * 5
print(min(kek))


employee_count = int(input())
line = input()
people_in_line = [int(i) for i in line.split()]
items = []
minium = -1
for i in range(employee_count):
	line = input()
	items.append([int(z) for z in line.split()])
for i in items:
	a = sum(i)
	temp = a * 5 + len(i) * 15
	if temp < minium or minium == -1:
		minium = temp
if minium == -1:
	print(0)
else:
	print(minium)