import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;

void main()
{
    int n = readln.chomp.to!int;
    auto cash = readln.split.map!(to!int);
    auto time = new int[](n);
    foreach (i; 0..n) {
        auto inp = readln.split.map!(to!int);
        foreach (j; 0..cash[i]) {
            time[i] += inp[j] * 5;
            time[i] += 15;
        }
    }
    time.reduce!(min).writeln;
    
}