Vasya plays the Power Defence. He must pass the last level of the game. In order to do this he must kill the Main Villain, who moves in a straight line at speed 1 meter per second from the point ( - ∞, 0) to the point ( + ∞, 0) of the game world. In the points (x, 1) and (x,  - 1), where x is an integer number, Vasya can build towers of three types: fire-tower, electric-tower or freezing-tower. However, it is not allowed to build two towers at the same point. Towers of each type have a certain action radius and the value of damage per second (except freezing-tower). If at some point the Main Villain is in the range of action of k freezing towers then his speed is decreased by k + 1 times.The allowed number of towers of each type is known. It is necessary to determine the maximum possible damage we can inflict on the Main Villain.All distances in the problem are given in meters. The size of the Main Villain and the towers are so small, that they can be considered as points on the plane. The Main Villain is in the action radius of a tower if the distance between him and tower is less than or equal to the action radius of the tower.

The first line contains three integer numbers nf, ne and ns — the maximum number of fire-towers, electric-towers and freezing-towers that can be built (0 ≤ nf, ne, ns ≤ 20, 1 ≤ nf + ne + ns ≤ 20). The numbers are separated with single spaces. The second line contains three integer numbers rf, re and rs (1 ≤ rf, re, rs ≤ 1000) — the action radii of fire-towers, electric-towers and freezing-towers. The numbers are separated with single spaces. The third line contains two integer numbers df and de (1 ≤ df, de ≤ 1000) — the damage a fire-tower and an electronic-tower can inflict on the Main Villain per second (in the case when the Main Villain is in the action radius of the tower). The numbers are separated with single space.

Print the only real number — the maximum possible damage to the Main Villain with absolute or relative error not more than 10 - 6.

NoteIn the first sample we've got one fire-tower that always inflicts the same damage, independently of its position. In the second sample we've got another freezing-tower of the same action radius. If we build the two towers opposite each other, then the Main Villain's speed will be two times lower, whenever he enters the fire-tower's action radius. That means that the enemy will be inflicted with twice more damage.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class E
{
    public static void main(String [] args) throws IOException
    {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);

        StringTokenizer tokenizer = new StringTokenizer(reader.readLine());
        int nf = Integer.parseInt(tokenizer.nextToken());
        int ne = Integer.parseInt(tokenizer.nextToken());
        int ns = Integer.parseInt(tokenizer.nextToken());
        int total = nf + ne + ns;

        tokenizer = new StringTokenizer(reader.readLine());
        double rf = Integer.parseInt(tokenizer.nextToken());
        double re = Integer.parseInt(tokenizer.nextToken());
        double rs = Integer.parseInt(tokenizer.nextToken());
        rf *= rf;
        rf -= 1;
        rf = Math.sqrt(rf);

        re *= re;
        re -= 1;
        re = Math.sqrt(re);

        rs *= rs;
        rs -= 1;
        rs = Math.sqrt(rs);

        tokenizer = new StringTokenizer(reader.readLine());
        int df = Integer.parseInt(tokenizer.nextToken());
        int de = Integer.parseInt(tokenizer.nextToken());

        double res = 0;

        for(int s = 0 ; s < 1<<total ; s++)
            if(Integer.bitCount(s) == ns)
            {
                double [] a = new double[ns];
                double [] b = new double[ns];
                int p = 0;
                for(int i = 0 ; i < total ; i++)
                    if(((1<<i) & s) != 0)
                    {
                        a[p] = i/2 - rs;
                        b[p] = i/2 + rs;
                        p++;
                    }

                double [] pf = new double[total-ns];
                double [] pe = new double[total-ns];
                int l = 0;
                double left, right;
                for(int i = 0 ; i < total ; i++)
                    if(((1<<i) & s) == 0)
                    {
                        pf[l] = 2*rf*df;
                        pe[l] = 2*re*de;

                        for(int j = 0 ; j < p ; j++)
                        {
                            {
                                left = i/2 - rf;
                                right = i/2 + rf;
                                left = Math.max(left, a[j]);
                                right = Math.min(right, b[j]);
                                if(left <= right)
                                {
                                    pf[l] += (right-left)*df;
                                }
                            }
                            {
                                left = i/2 - re;
                                right = i/2 + re;
                                left = Math.max(left, a[j]);
                                right = Math.min(right, b[j]);
                                if(left <= right)
                                {
                                    pe[l] += (right-left)*de;
                                }
                            }

                        }
                        l++;
                    }

                double [][] dp = new double[l+1][nf+1];
                boolean [][] reach = new boolean[l+1][nf+1];
                reach[0][0] = true;
                for(int till = 0 ; till < l ; till++)
                    for(int v = 0 ; v <= nf ; v++)
                        if(reach[till][v])
                        {
                            if(v != nf)
                            {
                                dp[till+1][v+1] = Math.max(dp[till+1][v+1], dp[till][v] + pf[till]);
                                reach[till+1][v+1] = true;
                            }
                            if(till-v != ne)
                            {
                                dp[till+1][v] = Math.max(dp[till+1][v], dp[till][v] +pe[till]);
                                reach[till+1][v] = true;
                            }
                        }

                res = Math.max(res, dp[l][nf]);
            }

        writer.println(res);
        writer.flush();
        writer.close();

    }
}

import java.util.NavigableSet;
import java.util.SortedSet;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.util.AbstractList;
import java.io.Writer;
import java.util.Collection;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
import java.util.NoSuchElementException;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Egor Kulikov (egor@egork.net)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {
	int n = 12;

	private int radiusFire;
	private int radiusElectric;
	private int radiusSlow;
	private int damageFire;
	private int damageElectric;
	int[] slowAt;
	private int countFire;
	private int countElectric;
	double[][][] result;
	double[] slowPoints;
	int[] slowOrder = new int[2 * n];
	double[] scoreFire = new double[n];
	double[] scoreElectric = new double[n];
	int[] countSlow = new int[2 * n + 1];
	private double[][] intersectFire;
	private double[][] intersectElectric;

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		countFire = in.readInt();
		countElectric = in.readInt();
		int countSlow = in.readInt();
		radiusFire = in.readInt();
		radiusElectric = in.readInt();
		radiusSlow = in.readInt();
		if (radiusSlow == 1)
			countSlow = 0;
		damageFire = in.readInt();
		damageElectric = in.readInt();
		slowAt = new int[n];
		result = new double[n + 1][countFire + 1][countElectric + 1];
		slowPoints = new double[2 * n];
		for (int i = 0; i < n; i++) {
			slowPoints[2 * i] = i - Math.sqrt(radiusSlow * radiusSlow - 1);
			slowPoints[2 * i + 1] = i + Math.sqrt(radiusSlow * radiusSlow - 1);
		}
		Integer[] reverseSlowOrder = ListUtils.order(Array.wrap(slowPoints));
		for (int i = 0; i < 2 * n; i++)
			slowOrder[reverseSlowOrder[i]] = i;
		Arrays.sort(slowPoints);
		intersectFire = new double[n][2 * n + 1];
		intersectElectric = new double[n][2 * n + 1];
		for (int i = 0; i < n; i++) {
			double start = i - Math.sqrt(radiusFire * radiusFire - 1);
			double end = i + Math.sqrt(radiusFire * radiusFire - 1);
			for (int j = 0; j < 2 * n + 1; j++) {
				double curStart = j == 0 ? Double.NEGATIVE_INFINITY : slowPoints[j - 1];
				double curFinish = j == 2 * n ? Double.POSITIVE_INFINITY : slowPoints[j];
				intersectFire[i][j] = Math.max(0, Math.min(end, curFinish) - Math.max(start, curStart));
			}
			start = i - Math.sqrt(radiusElectric * radiusElectric - 1);
			end = i + Math.sqrt(radiusElectric * radiusElectric - 1);
			for (int j = 0; j < 2 * n + 1; j++) {
				double curStart = j == 0 ? Double.NEGATIVE_INFINITY : slowPoints[j - 1];
				double curFinish = j == 2 * n ? Double.POSITIVE_INFINITY : slowPoints[j];
				intersectElectric[i][j] = Math.max(0, Math.min(end, curFinish) - Math.max(start, curStart));
			}
		}
		out.printLine(go(0, countSlow));
	}

	private double go(int step, int remaining) {
		if (step == slowAt.length) {
			if (remaining == 0)
				return count();
			return 0;
		}
		double result = 0;
		for (int i = 0; i <= 2 && i <= remaining; i++) {
			slowAt[step] = i;
			result = Math.max(result, go(step + 1, remaining - i));
		}
		return result;
	}

	private double count() {
		Arrays.fill(countSlow, 1);
		for (int i = 0; i < n; i++) {
			if (slowAt[i] != 0) {
				for (int j = slowOrder[2 * i]; j < slowOrder[2 * i + 1]; j++)
					countSlow[j + 1] += slowAt[i];
			}
		}
		for (int i = 0; i < n; i++) {
			scoreFire[i] = 0;
			scoreElectric[i] = 0;
			for (int j = 0; j < 2 * n + 1; j++) {
				scoreFire[i] += intersectFire[i][j] * countSlow[j] * damageFire;
				scoreElectric[i] += intersectElectric[i][j] * countSlow[j] * damageElectric;
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j <= countFire; j++) {
				for (int k = 0; k <= countElectric; k++) {
					result[i + 1][j][k] = result[i][j][k];
					if (slowAt[i] == 2)
						continue;
					if (j != countFire) {
						result[i + 1][j][k] = Math.max(result[i + 1][j][k], result[i][j + 1][k] + scoreFire[i]);
						if (slowAt[i] == 0) {
							if (j + 2 <= countFire)
								result[i + 1][j][k] = Math.max(result[i + 1][j][k], result[i][j + 2][k] + scoreFire[i] * 2);
							if (k < countElectric)
								result[i + 1][j][k] = Math.max(result[i + 1][j][k], result[i][j + 1][k + 1] + scoreFire[i] + scoreElectric[i]);
						}
					}
					if (k != countElectric) {
						result[i + 1][j][k] = Math.max(result[i + 1][j][k], result[i][j][k + 1] + scoreElectric[i]);
						if (slowAt[i] == 0 && k + 2 <= countElectric)
							result[i + 1][j][k] = Math.max(result[i + 1][j][k], result[i][j][k + 2] + 2 * scoreElectric[i]);
					}
				}
			}
		}
		return result[n][0][0];
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public static boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(outputStream);
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

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

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

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

	}

class ListUtils {

	public static Integer[] order(final List<? extends Comparable<?>>...sequences) {
		return ArrayUtils.order(sequences[0].size(), new Comparator<Integer>() {
			public int compare(Integer o1, Integer o2) {
				for (List<? extends Comparable> sequence : sequences) {
					//noinspection unchecked
					int value = sequence.get(o1).compareTo(sequence.get(o2));
					if (value != 0)
						return value;
				}
				return 0;
			}
		});
	}

	}

abstract class Array<T> extends AbstractList<T> {

	public static List<Double> wrap(double...array) {
		return new DoubleArray(array);
	}

	protected static class DoubleArray extends Array<Double> {
		protected final double[] array;

		protected DoubleArray(double[] array) {
			this.array = array;
		}

		public int size() {
			return array.length;
		}

		public Double get(int index) {
			return array[index];
		}

		public Double set(int index, Double value) {
			double result = array[index];
			array[index] = value;
			return result;
		}
	}

	}

class ArrayUtils {
	public static Integer[] generateOrder(int size) {
		Integer[] order = new Integer[size];
		for (int i = 0; i < size; i++)
			order[i] = i;
		return order;
	}

	public static Integer[] order(int size, Comparator<Integer> comparator) {
		Integer[] order = generateOrder(size);
		Arrays.sort(order, comparator);
		return order;
	}

	}

//package round115;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;

public class E {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int nf, ne, ns, rf, re, rs, df, de;
	int[] fct;

	void solve()
	{
		nf = ni(); ne = ni(); ns = ni();
		rf = ni(); re = ni(); rs = ni();
		df = ni(); de = ni();
		fct = new int[13];

		sqs = Math.sqrt(rs*rs-1);
		sqf = Math.sqrt(rf*rf-1);
		sqe = Math.sqrt(re*re-1);

		rec(0, 0);
		out.printf("%.9f\n", gm);
	}

	double gm = 0;
	double sqs, sqf, sqe;

	void rec(int pos, int num)
	{
		if(pos == 13){
			if(num == ns)go();
		}else{
			for(int i = 0;i <= 2 && num+i <= ns;i++){
				fct[pos] = i;
				rec(pos+1, num+i);
			}
		}
	}

	boolean[] cache = new boolean[3*3*3*3*3*3*3*3*3*3*3*3*3];
	int gct = 0;

	void go()
	{
		int code =  0;
		for(int i = 0;i < 13;i++){
			code = code * 3 + fct[i];
		}
		if(cache[code])return;
		code = 0;
		for(int i = 12;i >= 0;i--){
			code = code * 3 + fct[i];
		}
		cache[code] = true;

		double I = -999999999;
		double[][] dp = new double[nf+1][ne+1];
		for(int j = 0;j <= nf;j++)Arrays.fill(dp[j], I);
		dp[0][0] = 0;

		for(int i = 0;i < 13;i++){
			double tdf = calc(i-sqf, i+sqf) * df;
			double tde = calc(i-sqe, i+sqe) * de;
			for(int j = nf;j >= 0;j--){
				for(int k = ne;k >= 0;k--){
					if(dp[j][k] != I){
						for(int l = 0;l <= 2-fct[i] && j+l <= nf;l++){
							for(int m = 0;l+m <= 2-fct[i] && k+m <= ne;m++){
								dp[j+l][k+m] = Math.max(dp[j+l][k+m], dp[j][k] + tdf*l + tde*m);
							}
						}
					}
				}
			}
		}
//		for(int i = 1;i <= 13;i++){
//			double tdf = calc(ev, i-1-sqf, i-1+sqf) * df;
//			double tde = calc(ev, i-1-sqe, i-1+sqe) * de;
//			for(int j = 0;j <= nf;j++){
//				for(int k = 0;k <= ne;k++){
//					double max = 0;
//					for(int l = 0;l <= 2-fct[i-1] && l <= j;l++){
//						for(int m = 0;l+m <= 2-fct[i-1] && m <= k;m++){
//							max = Math.max(max, dp[i-1][j-l][k-m] + tdf*l + tde*m);
//						}
//					}
//					dp[i][j][k] = max;
//				}
//			}
//		}
		gm = Math.max(gm, dp[nf][ne]);
	}

	double calc(double s, double t)
	{
		double dmg = 0;
		for(int i = 0;i < 13;i++){
			if(fct[i] > 0){
				double w = Math.min(t, i+sqs) - Math.max(s, i-sqs);
				if(w > 0)dmg += w * fct[i];
			}
		}
		return dmg + (t-s);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{
		new E().run();
	}

	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Locale;
import java.util.Stack;
import java.util.StringTokenizer;

public class E {

	private void solve() throws IOException {
		int nf = nextInt();
		int ne = nextInt();
		int ns = nextInt();
		int rf = nextInt();
		int re = nextInt();
		int rs = nextInt();
		int df = nextInt();
		int de = nextInt();

		int n = nf + ne + ns;
		byte[] a = new byte[n];
		for (int i = 0; i < ns; i++) {
			a[i] = 1;
		}

		int sqrs = rs * rs;

		int cases = 0;

		int t = 2 * ns + 2;
		double[] p = new double[t];
		int[] b = new int[n];
		double[] f = new double[n];
		double[] e = new double[n];
		double[][] dp = new double[nf + 1][ne + 1];

		double res = 0;

		double d = Math.sqrt(sqrs - 1);
		while (true) {
			cases++;
			int k = 0;
			int q = 0;
			for (int i = 0; i < n; i++) {
				int x = 1000000 + i / 2;
				if (a[i] == 1) {
					p[k++] = x - d;
					p[k++] = -(x + d);
				} else {
					b[q++] = x;
				}
			}
			p[k++] = 0.0;
			p[k++] = -2000000.0;
//			Arrays.sort(p, cmp);
			for (int i = 0; i < p.length; i++) {
				for (int j = i + 1; j < p.length; j++) {
					if (Math.abs(p[i]) > Math.abs(p[j])) {
						double tmp = p[i];
						p[i] = p[j];
						p[j] = tmp;
					}
				}
			}

			for (int i = 0; i < q; i++) {
				f[i] = f(p, b[i], df, rf);
				e[i] = f(p, b[i], de, re);
			}

			for (int i = 1; i <= nf; i++) {
				dp[i][0] = dp[i - 1][0] + f[i - 1];
			}
			for (int i = 1; i <= ne; i++) {
				dp[0][i] = dp[0][i - 1] + e[i - 1];
			}

			for (int i = 1; i <= nf; i++) {
				for (int j = 1; j <= ne; j++) {
					dp[i][j] = Math.max(dp[i - 1][j] + f[i + j - 1], dp[i][j - 1] + e[i + j - 1]);
				}
			}

			res = Math.max(res, dp[nf][ne]);

			boolean next = false;
			int ones = 0;
			for (int i = 0; i < a.length; i++) {
				if (a[i] == 0) {
					if (ones != 0) {
						a[i] = 1;
						for (int j = 0; j < ones - 1; j++) {
							a[j] = 1;
						}
						for (int j = ones - 1; j < i; j++) {
							a[j] = 0;
						}
						next = true;
						break;
					}
				} else {
					ones++;
				}
			}

			if (!next) {
				break;
			}
		}

		println(res);
	}

	private double f(double[] p, int x, double damage, double R) {
		double dx = Math.sqrt(R * R - 1);
		double l = x - dx;
		double r = x + dx;

		double k = 1;
		double res = 0;
		for (int i = 1; i < p.length; i++) {
			double inter = inter(p[i - 1], p[i], l, r);
			res += damage * inter * k;
			if (p[i] > 0) {
				k++;
			} else {
				k--;
			}
		}

		return res;
	}

	private double inter(double l1, double r1, double l2, double r2) {
		l1 = Math.abs(l1);
		r1 = Math.abs(r1);
		l2 = Math.abs(l2);
		r2 = Math.abs(r2);
		double r = Math.min(r1, r2) - Math.max(l1, l2);
		if (r < 0) {
			return 0;
		} else {
			return r;
		}
	}

	private String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	private int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	private double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

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

	private void print(Object o) {
		writer.print(o);
	}

	private void println(Object o) {
		writer.println(o);
	}

	private void printf(String format, Object... o) {
		writer.printf(format, o);
	}

	public static void main(String[] args) {
		long time = System.currentTimeMillis();
		Locale.setDefault(Locale.US);
		new E().run();
		System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time));
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	private void run() {
		try {
			reader = new BufferedReader(new InputStreamReader(System.in));
			writer = new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(13);
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class E
{
    public static void main(String [] args) throws IOException
    {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);

        StringTokenizer tokenizer = new StringTokenizer(reader.readLine());
        int nf = Integer.parseInt(tokenizer.nextToken());
        int ne = Integer.parseInt(tokenizer.nextToken());
        int ns = Integer.parseInt(tokenizer.nextToken());
        int total = nf + ne + ns;

        tokenizer = new StringTokenizer(reader.readLine());
        double rf = Integer.parseInt(tokenizer.nextToken());
        double re = Integer.parseInt(tokenizer.nextToken());
        double rs = Integer.parseInt(tokenizer.nextToken());
        rf *= rf;
        rf -= 1;
        rf = Math.sqrt(rf);

        re *= re;
        re -= 1;
        re = Math.sqrt(re);

        rs *= rs;
        rs -= 1;
        rs = Math.sqrt(rs);

        tokenizer = new StringTokenizer(reader.readLine());
        int df = Integer.parseInt(tokenizer.nextToken());
        int de = Integer.parseInt(tokenizer.nextToken());

        double res = 0;

        for(int s = 0 ; s < 1<<total ; s++)
            if(Integer.bitCount(s) == ns)
            {
                double [] a = new double[ns];
                double [] b = new double[ns];
                int p = 0;
                for(int i = 0 ; i < total ; i++)
                    if(((1<<i) & s) != 0)
                    {
                        a[p] = i/2 - rs;
                        b[p] = i/2 + rs;
                        p++;
                    }

                double [] pf = new double[total-ns];
                double [] pe = new double[total-ns];
                int l = 0;
                double left, right;
                for(int i = 0 ; i < total ; i++)
                    if(((1<<i) & s) == 0)
                    {
                        pf[l] = 2*rf*df;
                        pe[l] = 2*re*de;

                        for(int j = 0 ; j < p ; j++)
                        {
                            {
                                left = i/2 - rf;
                                right = i/2 + rf;
                                left = Math.max(left, a[j]);
                                right = Math.min(right, b[j]);
                                if(left <= right)
                                {
                                    pf[l] += (right-left)*df;
                                }
                            }
                            {
                                left = i/2 - re;
                                right = i/2 + re;
                                left = Math.max(left, a[j]);
                                right = Math.min(right, b[j]);
                                if(left <= right)
                                {
                                    pe[l] += (right-left)*de;
                                }
                            }

                        }
                        l++;
                    }

                double [][] dp = new double[l+1][nf+1];
                for(int till = 0 ; till < l ; till++)
                    for(int v = 0 ; v <= nf ; v++)
                    {
                        if(v != nf)
                            dp[till+1][v+1] = Math.max(dp[till+1][v+1], dp[till][v] + pf[till]);
                        if(till-v != ne)
                            dp[till+1][v] = Math.max(dp[till+1][v], dp[till][v] +pe[till]);
                    }

                res = Math.max(res, dp[l][nf]);
            }

        writer.println(res);
        writer.flush();
        writer.close();

    }
}

//package round115;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;

public class E {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int nf, ne, ns, rf, re, rs, df, de;
	int[] fct;

	void solve()
	{
		nf = ni(); ne = ni(); ns = ni();
		rf = ni(); re = ni(); rs = ni();
		df = ni(); de = ni();
		fct = new int[13];

		rec(0, 0);
		tr(gct);
		out.printf("%.9f\n", gm);
	}

	double gm = 0;

	void rec(int pos, int num)
	{
		if(pos == 13){
			if(num == ns)go();
		}else{
			for(int i = 0;i <= 2 && num+i <= ns;i++){
				fct[pos] = i;
				rec(pos+1, num+i);
			}
		}
	}

	int gct = 0;

	void go()
	{
		if(ns > 0 && fct[0] == 0)return;
		double[][][] dp = new double[14][nf+1][ne+1];
		double[][] ev = new double[ns*2+2][];
		int p = 0;
		double sq = Math.sqrt(rs*rs-1);
		for(int i = 0;i < 13;i++){
			for(int j = 0;j < fct[i];j++){
				ev[p++] = new double[]{i - sq, 1};
				ev[p++] = new double[]{i + sq, -1};
			}
		}
		ev[p++] = new double[]{-10000000, 1};
		ev[p++] = new double[]{10000000, -1};
		Arrays.sort(ev, new Comparator<double[]>() {
			public int compare(double[] a, double[] b) {
				return (int)Math.signum(a[0] - b[0]);
			}
		});
		double sqf = Math.sqrt(rf*rf-1);
		double sqe = Math.sqrt(re*re-1);

		for(int i = 1;i <= 13;i++){
			double tdf = calc(ev, i-1-sqf, i-1+sqf) * df;
			double tde = calc(ev, i-1-sqe, i-1+sqe) * de;
			for(int j = 0;j <= nf;j++){
				for(int k = 0;k <= ne;k++){
					double max = 0;
					for(int l = 0;l <= 2-fct[i-1];l++){
						for(int m = 0;l+m <= 2-fct[i-1];m++){
							if(j-l >= 0 && k-m >= 0){
								max = Math.max(max, dp[i-1][j-l][k-m] + tdf*l + tde*m);
							}
						}
					}
					dp[i][j][k] = max;
				}
			}
		}
		gm = Math.max(gm, dp[13][nf][ne]);
	}

	double calc(double[][] e, double s, double t)
	{
		double dmg = 0;
		int d = 0;
		for(int i = 0;i < e.length - 1;i++){
			d += e[i][1];
			double w = Math.max(Math.min(t, e[i+1][0]) - Math.max(s, e[i][0]), 0);
			dmg += w * d;
		}
		return dmg;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{
		new E().run();
	}

	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

//package round115;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;

public class E {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int nf, ne, ns, rf, re, rs, df, de;
	int[] fct;

	void solve()
	{
		nf = ni(); ne = ni(); ns = ni();
		rf = ni(); re = ni(); rs = ni();
		df = ni(); de = ni();
		fct = new int[13];

		sqs = Math.sqrt(rs*rs-1);
		sqf = Math.sqrt(rf*rf-1);
		sqe = Math.sqrt(re*re-1);

		dp = new double[2][nf+1][ne+1];
		rec(0, 0);
		out.printf("%.9f\n", gm);
	}

	double gm = 0;
	double sqs, sqf, sqe;

	void rec(int pos, int num)
	{
		if(pos == 13){
			if(num == ns)go();
		}else{
			for(int i = 0;i <= 2 && num+i <= ns;i++){
				fct[pos] = i;
				rec(pos+1, num+i);
			}
		}
	}

	boolean[] cache = new boolean[3*3*3*3*3*3*3*3*3*3*3*3*3];
	int gct = 0;
	double[][][] dp;

	void go()
	{
		int code =  0;
		for(int i = 0;i < 13;i++){
			code = code * 3 + fct[i];
		}
		if(cache[code])return;
		code = 0;
		for(int i = 12;i >= 0;i--){
			code = code * 3 + fct[i];
		}
		cache[code] = true;

		double I = -999999999;
		for(int j = 0;j <= nf;j++)Arrays.fill(dp[0][j], I);
		dp[0][0][0] = 0;

		int cur = 1, prev = 0;
		for(int i = 0;i < 13;i++, cur^=1, prev^=1){
			for(int j = 0;j <= nf;j++)Arrays.fill(dp[cur][j], I);

			double tdf = calc(i-sqf, i+sqf) * df;
			double tde = calc(i-sqe, i+sqe) * de;
			for(int j = 0;j <= nf;j++){
				for(int k = 0;k <= ne;k++){
					if(dp[prev][j][k] != I){
						for(int l = 0;l <= 2-fct[i] && j+l <= nf;l++){
							for(int m = 0;l+m <= 2-fct[i] && k+m <= ne;m++){
								dp[cur][j+l][k+m] = Math.max(dp[cur][j+l][k+m], dp[prev][j][k] + tdf*l + tde*m);
							}
						}
					}
				}
			}
		}
//		for(int i = 1;i <= 13;i++){
//			double tdf = calc(ev, i-1-sqf, i-1+sqf) * df;
//			double tde = calc(ev, i-1-sqe, i-1+sqe) * de;
//			for(int j = 0;j <= nf;j++){
//				for(int k = 0;k <= ne;k++){
//					double max = 0;
//					for(int l = 0;l <= 2-fct[i-1] && l <= j;l++){
//						for(int m = 0;l+m <= 2-fct[i-1] && m <= k;m++){
//							max = Math.max(max, dp[i-1][j-l][k-m] + tdf*l + tde*m);
//						}
//					}
//					dp[i][j][k] = max;
//				}
//			}
//		}
		gm = Math.max(gm, dp[prev][nf][ne]);
	}

	double calc(double s, double t)
	{
		double dmg = 0;
		for(int i = 0;i < 13;i++){
			if(fct[i] > 0){
				double w = Math.min(t, i+sqs) - Math.max(s, i-sqs);
				if(w > 0)dmg += w;
			}
		}
		return dmg + (t-s);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{
		new E().run();
	}

	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

//package round115;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;

public class E {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	int nf, ne, ns, rf, re, rs, df, de;
	int[] fct;

	void solve()
	{
		nf = ni(); ne = ni(); ns = ni();
		rf = ni(); re = ni(); rs = ni();
		df = ni(); de = ni();
		fct = new int[13];

		sqs = Math.sqrt(rs*rs-1);
		sqf = Math.sqrt(rf*rf-1);
		sqe = Math.sqrt(re*re-1);

		dp = new double[2][nf+1][ne+1];
		rec(0, 0);
		out.printf("%.9f\n", gm);
	}

	double gm = 0;
	double sqs, sqf, sqe;

	void rec(int pos, int num)
	{
		if(pos == 13){
			if(num == ns)go();
		}else{
			for(int i = 0;i <= 2 && num+i <= ns;i++){
				fct[pos] = i;
				rec(pos+1, num+i);
			}
		}
	}

	boolean[] cache = new boolean[3*3*3*3*3*3*3*3*3*3*3*3*3];
	int gct = 0;
	double[][][] dp;

	void go()
	{
		int code =  0;
		for(int i = 0;i < 13;i++){
			code = code * 3 + fct[i];
		}
		if(cache[code])return;
		code = 0;
		for(int i = 12;i >= 0;i--){
			code = code * 3 + fct[i];
		}
		cache[code] = true;

		double I = -999999999;
		for(int j = 0;j <= nf;j++)Arrays.fill(dp[0][j], I);
		dp[0][0][0] = 0;

		double[][] ev = new double[ns][];
		int p = 0;
		for(int i = 0;i < 13;i++){
			for(int j = 0;j < fct[i];j++){
				ev[p++] = new double[]{i-sqs, i+sqs};
			}
		}

		int cur = 1, prev = 0;
		for(int i = 0;i < 13;i++, cur^=1, prev^=1){
			for(int j = 0;j <= nf;j++)Arrays.fill(dp[cur][j], I);

			double tdf = calc(ev, i-sqf, i+sqf) * df;
			double tde = calc(ev, i-sqe, i+sqe) * de;
			for(int j = 0;j <= nf;j++){
				for(int k = 0;k <= ne;k++){
					if(dp[prev][j][k] != I){
						for(int l = 0;l <= 2-fct[i] && j+l <= nf;l++){
							for(int m = 0;l+m <= 2-fct[i] && k+m <= ne;m++){
								dp[cur][j+l][k+m] = Math.max(dp[cur][j+l][k+m], dp[prev][j][k] + tdf*l + tde*m);
							}
						}
					}
				}
			}
		}
//		for(int i = 1;i <= 13;i++){
//			double tdf = calc(ev, i-1-sqf, i-1+sqf) * df;
//			double tde = calc(ev, i-1-sqe, i-1+sqe) * de;
//			for(int j = 0;j <= nf;j++){
//				for(int k = 0;k <= ne;k++){
//					double max = 0;
//					for(int l = 0;l <= 2-fct[i-1] && l <= j;l++){
//						for(int m = 0;l+m <= 2-fct[i-1] && m <= k;m++){
//							max = Math.max(max, dp[i-1][j-l][k-m] + tdf*l + tde*m);
//						}
//					}
//					dp[i][j][k] = max;
//				}
//			}
//		}
		gm = Math.max(gm, dp[prev][nf][ne]);
	}

	double calc(double[][] e, double s, double t)
	{
		double dmg = 0;
		for(double[] f : e){
			double w = Math.min(t, f[1]) - Math.max(s, f[0]);
			if(w > 0)dmg += w;
		}
		return dmg;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{
		new E().run();
	}

	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Locale;
import java.util.Stack;
import java.util.StringTokenizer;

public class E {

	private void solve() throws IOException {
		int nf = nextInt();
		int ne = nextInt();
		int ns = nextInt();
		int rf = nextInt();
		int re = nextInt();
		int rs = nextInt();
		int df = nextInt();
		int de = nextInt();

		int n = nf + ne + ns;
		byte[] a = new byte[n];
		for (int i = 0; i < ns; i++) {
			a[i] = 1;
		}

		int sqrs = rs * rs;

		Comparator<Double> cmp = new Comparator<Double>() {
			@Override
			public int compare(Double o1, Double o2) {
				double d = Math.signum(Math.abs(o1) - Math.abs(o2));
				if (d < 0) {
					return -1;
				} else if (d > 0) {
					return 1;
				} else {
					return 0;
				}
			}
		};

		int t = 2 * ns + 2;
		Double[] p = new Double[t];
		int[] b = new int[n];
		double[] f = new double[n];
		double[] e = new double[n];
		double[][] dp = new double[nf + 1][ne + 1];

		double res = 0;

		while (true) {
			int k = 0;
			int q = 0;
			for (int i = 0; i < n; i++) {
				int x = 1000000 + i / 2;
				if (a[i] == 1) {
					double d = Math.sqrt(sqrs - 1);
					p[k++] = x - d;
					p[k++] = -(x + d);
				} else {
					b[q++] = x;
				}
			}
			p[k++] = 0.0;
			p[k++] = -2000000.0;
			Arrays.sort(p, cmp);

			for (int i = 0; i < q; i++) {
				f[i] = f(p, b[i], df, rf);
				e[i] = f(p, b[i], de, re);
			}

			for (int i = 1; i <= nf; i++) {
				dp[i][0] = dp[i - 1][0] + f[i - 1];
			}
			for (int i = 1; i <= ne; i++) {
				dp[0][i] = dp[0][i - 1] + e[i - 1];
			}

			for (int i = 1; i <= nf; i++) {
				for (int j = 1; j <= ne; j++) {
					dp[i][j] = Math.max(dp[i - 1][j] + f[i + j - 1], dp[i][j - 1] + e[i + j - 1]);
				}
			}

			res = Math.max(res, dp[nf][ne]);

			boolean next = false;
			int ones = 0;
			for (int i = 0; i < a.length - 1; i++) {
				if (a[i] == 0) {
					if (ones != 0) {
						a[i] = 1;
						for (int j = 0; j < ones - 1; j++) {
							a[j] = 1;
						}
						for (int j = ones - 1; j < i; j++) {
							a[j] = 0;
						}
						next = true;
						break;
					}
				} else {
					ones++;
				}
			}

			if (!next) {
				break;
			}
		}

		println(res);
	}

	private double f(Double[] p, int x, double damage, double R) {
		double dx = Math.sqrt(R * R - 1);
		double l = x - dx;
		double r = x + dx;

		double k = 1;
		double res = 0;
		for (int i = 1; i < p.length; i++) {
			double inter = inter(p[i - 1], p[i], l, r);
			res += damage * inter / (1 / k);
			if (p[i] > 0) {
				k++;
			} else {
				k--;
			}
		}

		return res;
	}

	private double inter(double l1, double r1, double l2, double r2) {
		l1 = Math.abs(l1);
		r1 = Math.abs(r1);
		l2 = Math.abs(l2);
		r2 = Math.abs(r2);
		double r = Math.min(r1, r2) - Math.max(l1, l2);
		if (r < 0) {
			return 0;
		} else {
			return r;
		}
	}

	private String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	private int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	private double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

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

	private void print(Object o) {
		writer.print(o);
	}

	private void println(Object o) {
		writer.println(o);
	}

	private void printf(String format, Object... o) {
		writer.printf(format, o);
	}

	public static void main(String[] args) {
		long time = System.currentTimeMillis();
		Locale.setDefault(Locale.US);
		new E().run();
		System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time));
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	private void run() {
		try {
			reader = new BufferedReader(new InputStreamReader(System.in));
			writer = new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(13);
		}
	}
}