// Arup Guha
// 11/11/2017
// Solution to 2017 SER D2 Problem: Unloaded Die

import java.util.*;

public class unloaded {

	public static void main(String[] args) {

		// Read in the data - store current expectation.
		Scanner stdin = new Scanner(System.in);
		double[] prob = new double[6];
		double exp = 0;
		for (int i=0; i<6; i++) {
			prob[i] = stdin.nextDouble();
			exp += ((i+1)*prob[i]);
		}

		// The real answer can't be more than 6, so I can set it to this.
		double res = 6;

		// Try each side.
		for (int i=0; i<6; i++) {

			// Doesn't change expectation, avoids divide by 0.
			if (Math.abs(prob[i]) < 1e-9) continue;

			// Take out this term and see what would label would replace it.
			double sum = exp - prob[i]*(i+1);
			double label = (3.5 - sum)/prob[i];
			res = Math.min(res, Math.abs(label-i-1));
		}

		// Ta da!
		System.out.printf("%.3f\n", res);
	}
}