Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point values of 500, 1000, 1500, 2000, and 2500, respectively. Despite the challenging tasks, Kevin was uncowed and bulldozed through all of them, distinguishing himself from the herd as the best cowmputer scientist in all of Bovinia. Kevin knows his submission time for each problem, the number of wrong submissions that he made on each problem, and his total numbers of successful and unsuccessful hacks. Because Codeforces scoring is complicated, Kevin wants you to write a program to compute his final score.

Codeforces scores are computed as follows: If the maximum point value of a problem is x, and Kevin submitted correctly at minute m but made w wrong submissions, then his score on that problem is <image>. His total score is equal to the sum of his scores for each problem. In addition, Kevin's total score gets increased by 100 points for each successful hack, but gets decreased by 50 points for each unsuccessful hack.

All arithmetic operations are performed with absolute precision and no rounding. It is guaranteed that Kevin's final score is an integer.

Input

The first line of the input contains five space-separated integers m1, m2, m3, m4, m5, where mi (0 ≤ mi ≤ 119) is the time of Kevin's last submission for problem i. His last submission is always correct and gets accepted.

The second line contains five space-separated integers w1, w2, w3, w4, w5, where wi (0 ≤ wi ≤ 10) is Kevin's number of wrong submissions on problem i.

The last line contains two space-separated integers hs and hu (0 ≤ hs, hu ≤ 20), denoting the Kevin's numbers of successful and unsuccessful hacks, respectively.

Output

Print a single integer, the value of Kevin's final score.

Examples

Input

20 40 60 80 100
0 1 2 3 4
1 0


Output

4900


Input

119 119 119 119 119
0 0 0 0 0
10 0


Output

4930

Note

In the second sample, Kevin takes 119 minutes on all of the problems. Therefore, he gets <image> of the points on each problem. So his score from solving problems is <image>. Adding in 10·100 = 1000 points from hacks, his total score becomes 3930 + 1000 = 4930.
import java.io.*;
import java.math.BigDecimal;

import java.math.BigInteger;
import java.math.MathContext;

import java.util.*;




/**
 *       ____ _ ___   _____ ____ ___   ____ _ ____
 *      / __ `// _ \ / ___// __ `__ \ / __ `// __ \
 *     / /_/ //  __// /   / / / / / // /_/ // / / /
 *     \__, / \___//_/   /_/ /_/ /_/ \__,_//_/ /_/
 *    /____/
 *
 * @author German Ganys
 * @version 1.3
 * @apiNote update in 04.12.15 at 20.44
 *
 */

public class Main {

    final String INPUT_FILE = "INPUT.TXT";
    final String OUTPUT_FILE = "OUTPUT.TXT";
    boolean eof;
    boolean is_inverted = false;



    /**=======MAIN=======*/
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
    /**==================*/



    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    //PrintWriter writer = new PrintWriter(System.out);
    //BufferedReader reader;
   // PrintWriter writer;
    StringTokenizer stringTokenizer;

    {/*
        try {
            writer = new PrintWriter(OUTPUT_FILE);
            reader = new BufferedReader(new FileReader(INPUT_FILE));
        } catch (FileNotFoundException e) {
            System.out.println("\033[35;1mFATAL FILE ERROR!");
            System.out.println("\033[36;1m" + e);
        }*/
    }


    /*===================================================================================================*/
    /*========================================INTERNAL===================================================*/
    /*===================================================================================================*/
    /**Clean Output Stream*/
        public void flush() {

        System.out.flush();
    }
    /**Stop running program*/
    public void stop(int n){
        System.exit(n);
    }

    /**
     * Bubble Sorting
     * @param data - Input Massive
     * @param bool - If True Inverted Sort ,Else Not Inverted
     * */

        public static int[] bubbleSort ( int[] data, boolean bool){
        for (int border = data.length - 1; border >= 0; border--)
            for (int index = 0; index < border; index++)
                if (bool == true) {
                    if (data[index] < data[index + 1])
                        swap(data, index, index + 1);
                } else if (bool == false) {
                    if (data[index] > data[index + 1])
                        swap(data, index, index + 1);
                }

        return data;
    }

    public static void swap(int[] data, int i, int j) {
        int temp = data[i];
        data[i] = data[j];
        data[j] = temp;
    }
/**Middle Binary searching
 * @param a - Input Massive
 * @param key - Index of Element
 * */
    public static int binarySearch_mid(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = lo + (hi - lo) / 2;
            if (key < a[mid])
                hi = mid - 1;
            else {
                if (key > a[mid])
                    lo = mid + 1;
                else
                    return mid;
            }
        }
        return -1;
    }
    /**Left Border Binary searching
     * @param a - Input Massive
     * @param key - Index of Element
     * */
    public static int binarySearch_left(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            if (a[lo] == key)
                return lo;
            int mid = lo + (hi - lo) / 2;
            if (key < a[mid]) hi = mid - 1;
            else {
                if (key > a[mid])
                    lo = mid + 1;
                else {
                    hi = mid;
                    lo++;
                }
            }
        }
        return -1;
    }
    /**Right Border Binary searching
     * @param a - Input Massive
     * @param key - Index of Element
     * */
    public static int binarySearch_right(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            if (a[hi] == key)
                return hi;
            int mid = lo + (hi - lo) / 2;
            if (key < a[mid]) hi = mid - 1;
            else {
                if (key > a[mid])
                    lo = mid + 1;
                else {
                    lo = mid;
                    hi--;
                }
            }
        }
        return -1;
    }


    String next() throws IOException {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            stringTokenizer = new StringTokenizer(reader.readLine());

        }
        return stringTokenizer.nextToken();
    }

    public String nextString() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }

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

    public int[] nextInts(int N) throws IOException {
        int[] nums = new int[N];
        for (int i = 0; i < N; i++)
            nums[i] = nextInt();
        return nums;
    }

    public long[] nextLongs(int N) throws IOException {
        long[] nums = new long[N];
        for (int i = 0; i < N; i++)
            nums[i] = nextLong();
        return nums;
    }

    public double[] nextDoubles(int N) throws IOException {
        double[] nums = new double[N];
        for (int i = 0; i < N; i++)
            nums[i] = nextDouble();
        return nums;
    }

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

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


    public int lenght_long(long number) {
        String temp = "" + number;

        return temp.length();
    }

    public int lenght_int(int number) {
        String temp = "" + number;

        return temp.length();
    }

    public int lenght_double(double number) {
        String temp = "" + number;

        return temp.length();
    }
    public int lenght_string(String line) {
        String temp = line;

        return temp.length();
    }


    private int number_lines() throws IOException {
        int i = 0;
        while (reader.readLine() != null)
            i++;
        return i;
        //returns number of lines
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }

    final  BigDecimal PI = new BigDecimal("3.141592653589793238462643383279502884197169399375105820974944592307816406286");

    BigDecimal big_sqrt(BigDecimal y) {
        MathContext mathContext = new MathContext(100);
        if (y.doubleValue() < 1e-8) {
            return y;
        }
        BigDecimal x = y;
        for (int i = 0; i < 50; ++i) {
            x = x.subtract(x.multiply(x).subtract(y).divide(BigDecimal.valueOf(2).multiply(x), mathContext));
        }
        return x;
    }
    BigDecimal big_acos(BigDecimal y) {
        MathContext mathContext = new MathContext(100);
        BigDecimal x = BigDecimal.ZERO, hpi = PI.multiply(BigDecimal.valueOf(0.5), mathContext);
        for (int i = 0; i < 50; ++i) {
            x = x.subtract(big_sin(x).subtract(y).divide(big_cos(x), mathContext));
        }
        return hpi.subtract(x);
    }

    BigDecimal big_cos(BigDecimal y) {
        BigDecimal ret = BigDecimal.ZERO, x = y;
        MathContext mathContext = new MathContext(100);
        y = BigDecimal.ONE;
        for (int i = 0; i < 100; i += 2) {
            ret = ret.add(y);
            y = y.multiply(x.multiply(x).divide(BigDecimal.valueOf((-i - 1) * (i + 2)), mathContext));
        }
        return ret;
    }

    BigDecimal big_sin(BigDecimal y) {
        BigDecimal ret = BigDecimal.ZERO, x = y;
        MathContext mathContext = new MathContext(100);
        for (int i = 1; i < 100; i += 2) {
            ret = ret.add(y);
            y = y.multiply(x.multiply(x).divide(BigDecimal.valueOf((-i - 1) * (i + 2)), mathContext));
        }
        return ret;
    }
    /**
     * Method List:
     *
     * flush()
     * stop(x) x=exit code.
     * bubbleSort(mass[],bool) mass[]=input massive, bool=If True Inverted Sort ,Else Not Inverted
     * binarySearch_mid(mass[],key),binarySearch_Left(mass[],key),binarySearch_Right(mass[],key)  mass=input massive,key=number of element
     * nextString()
     * nextInt()
     * nextInts(M) M = massive to input
     * nextLongs(M) M = massive to input
     * nextDouble()
     * nextDoubles(M) M = massive to input
     * lenght_long(N) N = number to count
     * lenght_int(N) N = number to count
     * lenght_double(N) N = number to count
     * number_lines() returns number of input lines
     * big_sqrt(N) N = number
     * big_acos(N) N = number
     * big_cos(N) N = number
     * big_sin(N) N = number
     *lenght_string(String line) return number of chars in string
     * Coming Soon...
     * */

    /*===================================================================================================*/
    /*========================================INTERNAL===================================================*/
    /*===================================================================================================*/


    void solve() throws IOException {

        int[] points = { 500, 1000, 1500, 2000, 2500};
        int[] m = new int[5];
        int[] w = new int[5];
        double answer = 0;
        for(int i=0;i<5;i++) {
            m[i] = nextInt();
        }
        for (int x = 0;x<5;x++){
            w[x] = nextInt();
            answer+=Math.max(0.3*points[x], (1-(1.0*m[x]/250))*points[x]-50*w[x]);
        }

        answer+=nextInt()*100;
        answer-=nextInt()*50;
        System.out.print((int)answer+"");




    }
}
