# 408A - Line to Cashier

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

ad6e1e64e7e95cafd9da52b648476642df277499
<mask token>

<mask token>
for i in range(n):
    add = 0
    l = list(map(int, input().split()))
    add = sum(l) * 5 + len(l) * 15
    m.append(add)
print(min(m))

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

# 408A - Line to Cashier

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