Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. 

There is only one shower and there are multiple students who wish to have a shower in the morning. That's why every morning there is a line of five people in front of the dormitory shower door. As soon as the shower opens, the first person from the line enters the shower. After a while the first person leaves the shower and the next person enters the shower. The process continues until everybody in the line has a shower.

Having a shower takes some time, so the students in the line talk as they wait. At each moment of time the students talk in pairs: the (2i - 1)-th man in the line (for the current moment) talks with the (2i)-th one. 

Let's look at this process in more detail. Let's number the people from 1 to 5. Let's assume that the line initially looks as 23154 (person number 2 stands at the beginning of the line). Then, before the shower opens, 2 talks with 3, 1 talks with 5, 4 doesn't talk with anyone. Then 2 enters the shower. While 2 has a shower, 3 and 1 talk, 5 and 4 talk too. Then, 3 enters the shower. While 3 has a shower, 1 and 5 talk, 4 doesn't talk to anyone. Then 1 enters the shower and while he is there, 5 and 4 talk. Then 5 enters the shower, and then 4 enters the shower.

We know that if students i and j talk, then the i-th student's happiness increases by gij and the j-th student's happiness increases by gji. Your task is to find such initial order of students in the line that the total happiness of all students will be maximum in the end. Please note that some pair of students may have a talk several times. In the example above students 1 and 5 talk while they wait for the shower to open and while 3 has a shower.

Input

The input consists of five lines, each line contains five space-separated integers: the j-th number in the i-th line shows gij (0 ≤ gij ≤ 105). It is guaranteed that gii = 0 for all i.

Assume that the students are numbered from 1 to 5.

Output

Print a single integer — the maximum possible total happiness of the students.

Examples

Input

0 0 0 0 9
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
7 0 0 0 0


Output

32


Input

0 43 21 18 2
3 0 21 11 65
5 2 0 1 4
54 62 12 0 99
87 64 81 33 0


Output

620

Note

In the first sample, the optimal arrangement of the line is 23154. In this case, the total happiness equals:

(g23 + g32 + g15 + g51) + (g13 + g31 + g54 + g45) + (g15 + g51) + (g54 + g45) = 32.
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    public static void main (String[] args) {
        FastReader in = new FastReader(System.in);

        int[][] a = new int[5][];
        for (int i = 0; i < 5; i++) {
            a[i] = in.nextIntArray(5);
        }

        List<Integer> v = Arrays.asList(0, 1, 2, 3, 4);

        int max = -1;

        for (int i = 0; i < 120; i++) {
            int t = a[v.get(0)][v.get(1)] + a[v.get(1)][v.get(0)];
            t += a[v.get(2)][v.get(3)] + a[v.get(3)][v.get(2)];
            t += a[v.get(1)][v.get(2)] + a[v.get(2)][v.get(1)];
            t += a[v.get(3)][v.get(4)] + a[v.get(4)][v.get(3)];
            t += a[v.get(2)][v.get(3)] + a[v.get(3)][v.get(2)];
            t += a[v.get(3)][v.get(4)] + a[v.get(4)][v.get(3)];

            max = Math.max(max, t);

            nextPermutation(v);
        }

        System.out.println(max);

    }

    public static <T extends Comparable<? super T>> boolean nextPermutation(List<T> list) {
        if (list.size() <= 1) return false;

        int selected = list.size() - 2;
        while (selected >= 0 && list.get(selected).compareTo(list.get(selected + 1)) >= 0)
            --selected;
        List<T> greaterPermutation = list.subList(selected + 1, list.size());

        Collections.reverse(greaterPermutation);
        if (selected != -1) {
            int subIndex = Collections.binarySearch(greaterPermutation, list.get(selected));
            if (subIndex >= 0) {
                while (list.get(selected).compareTo(greaterPermutation.get(subIndex)) == 0)
                    ++subIndex;
            } else {
                subIndex = -(subIndex + 1);
            }
            T otherElement = greaterPermutation.get(subIndex);
            greaterPermutation.set(subIndex, list.get(selected));
            list.set(selected, otherElement);

            return true;
        } else {
            return false;
        }
    }
}

class FastReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public FastReader(InputStream stream) {
        this.reader = new BufferedReader(new InputStreamReader(stream));
        this.tokenizer = new StringTokenizer("");
    }

    public boolean hasNext() {
        return ensureTokens();
    }

    public String next() {
        return  ensureTokens() ? tokenizer.nextToken() : null;
    }

    private boolean ensureTokens() {
        while(!tokenizer.hasMoreTokens()){
            try{
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (Exception e){
                return false;
            }
        }
        return true;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (Exception e) {
            return null;
        }
    }

    public char[] nextCharArray() {
        return nextLine().toCharArray();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public int[] nextIntArray(int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = nextInt();
        }
        return array;
    }

    public int[] nextIntArrayOnLine() {
        String line = nextLine();
        String[] tokens = line.split(" ");
        int[] array = new int[tokens.length];
        for (int i = 0; i < tokens.length; i++) {
            array[i] = Integer.parseInt(tokens[i]);
        }
        return array;
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public long[] nextLongArray(int size) {
        long[] array = new long[size];
        for (int i = 0; i < size; i++) {
            array[i] = nextLong();
        }
        return array;
    }

    public float nextFloat() {
        return Float.parseFloat(next());
    }

    public float[] nextFloatArray(int size) {
        float[] array = new float[size];
        for (int i = 0; i < size; i++) {
            array[i] = nextFloat();
        }
        return array;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public double[] nextDoubleArray(int size) {
        double[] array = new double[size];
        for (int i = 0; i < size; i++) {
            array[i] = nextDouble();
        }
        return array;
    }

    public short nextShort() {
        return Short.parseShort(next());
    }

    public short[] nextShortArray(int size) {
        short[] array = new short[size];
        for (int i = 0; i < size; i++) {
            array[i] = nextShort();
        }
        return array;
    }

    public BigDecimal nextBigDecimal() {
        return new BigDecimal(next());
    }

    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }
}

class FastWriter {
    private final PrintWriter printWriter;

    public FastWriter(OutputStream stream) {
        printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));
    }

    public FastWriter(Writer writer) {
        printWriter = new PrintWriter(writer);
    }

    public void close() {
        printWriter.close();
    }

    public void print(boolean element) {
        printWriter.print(element);
    }

    public void print(char[] element) {
        printWriter.print(element);
    }

    public void print(double element) {
        printWriter.print(element);
    }

    public void print(float element) {
        printWriter.print(element);
    }

    public void print(int element) {
        printWriter.print(element);
    }

    public void print(long element) {
        printWriter.print(element);
    }

    public void print(String element) {
        printWriter.print(element);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                printWriter.print(' ');
            }
            printWriter.print(objects[i]);
        }
    }

    public void println(boolean element) {
        printWriter.println(element);
    }

    public void println(char[] element) {
        printWriter.println(element);
    }

    public void println(double element) {
        printWriter.println(element);
    }

    public void println(float element) {
        printWriter.println(element);
    }

    public void println(int element) {
        printWriter.println(element);
    }

    public void println(long element) {
        printWriter.println(element);
    }

    public void println(String element) {
        printWriter.println(element);
    }

    public void println() {
        printWriter.println();
    }

    public void println(Object... objects) {
        print(objects);
        printWriter.println();
    }

    public void printf(String format, Object... args) {
        printWriter.printf(format, args);
    }
}

