import java.util.Scanner;

public class Main {
	private static Scanner sc;

	public static void main(String[] args) throws Exception {
		sc = new Scanner(System.in);
		double[] ary = new double[5];
		for (int i = 0; i < 5; i++) {
			ary[i] = sc.nextInt();

		}

		for (int i = 0; i < ary.length - 1; i++) {
			if (ary[i] % 10 == 0) {
				continue;
			}
			if (ary[ary.length - 1] % 10 == 0 || ary[ary.length - 1] % 10 > ary[i] % 10) {
				double tmp = ary[ary.length - 1];
				ary[ary.length - 1] = ary[i];
				ary[i] = tmp;
			}

		}

		double a = 0;

		for (int i = 0; i < ary.length; i++) {
			if (i == ary.length - 1) {
				a += ary[i];
			} else {

				a += Math.ceil(ary[i] / 10) * 10;
			}

		}

		System.out.println(String.format("%.0f", a));

	}

}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz