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*<sub class="lower-index">*i*</sub> people. The *j*-th person standing in the queue to the *i*-th cashier has *m*<sub class="lower-index">*i*, *j*</sub> 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.
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*<sub class="lower-index">1</sub>, *k*<sub class="lower-index">2</sub>, ..., *k*<sub class="lower-index">*n*</sub> (1 ≤ *k*<sub class="lower-index">*i*</sub> ≤ 100), where *k*<sub class="lower-index">*i*</sub> is the number of people in the queue to the *i*-th cashier.

The *i*-th of the next *n* lines contains *k*<sub class="lower-index">*i*</sub> space-separated integers: *m*<sub class="lower-index">*i*, 1</sub>, *m*<sub class="lower-index">*i*, 2</sub>, ..., *m*<sub class="lower-index">*i*, *k*<sub class="lower-index">*i*</sub></sub> (1 ≤ *m*<sub class="lower-index">*i*, *j*</sub> ≤ 100) — the number of products the *j*-th person in the queue for the *i*-th cash has.
def calc_total_time(num_people, items_in_baskets):
    scan_time_per_item = 5
    payment_time = 15
    total_time = 0

    for items in items_in_baskets:
        total_time += (items * scan_time_per_item) + payment_time

    return total_time


def find_min_time(num_cashiers, queue_sizes, items_in_baskets):
    min_time = float('inf')

    for i in range(num_cashiers):
        time_to_cashier = calc_total_time(queue_sizes[i], items_in_baskets[i])
        min_time = min(min_time, time_to_cashier)

    return min_time


n = int(input())
qsizes = list(map(int, input().split()))
items = []

for _ in range(n):
    item_list = list(map(int, input().split()))
    items.append(item_list)

print(find_min_time(n, qsizes, items))
