import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		Dishes dishes = new Dishes(a, b, c, d, e);
		System.out.println(dishes.getTotalTime());
	}

}

class Dishes {
	ArrayList<Integer> times = new ArrayList<Integer>();
	ArrayList<Integer> losses = new ArrayList<>();

	Dishes(int... times) {
		for (int t : times) {
			this.times.add(t);
			int loss = (10 - t % 10) % 10;
			losses.add(loss);
		}
	}

	int getTotalTime() {
		int totalTime = 0;
		int maxLoss = 0;
		for (int time : times) {
			totalTime += time;
		}
		for (int loss : losses) {
			totalTime += loss;
			if (loss > maxLoss) {
				maxLoss = loss;
			}
		}
		totalTime -= maxLoss;
		return totalTime;
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		Dishes dishes = new Dishes(a, b, c, d, e);
		System.out.println(dishes.getTotalTime());
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		Dishes dishes = new Dishes(a, b, c, d, e);
		System.out.println(dishes.getTotalTime());
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		Dishes dishes = new Dishes(a, b, c, d, e);
		System.out.println(dishes.getTotalTime());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc Dishes dishes = new Dishes(a, b, c, d, e); dishes new Dishes(a, b, c, d, e) System.out.println(dishes.getTotalTime()) System.out.println System.out System System.out dishes.getTotalTime() dishes.getTotalTime dishes String[] args args class Dishes {
	ArrayList<Integer> times = new ArrayList<Integer>();
	ArrayList<Integer> losses = new ArrayList<>();

	Dishes(int... times) {
		for (int t : times) {
			this.times.add(t);
			int loss = (10 - t % 10) % 10;
			losses.add(loss);
		}
	}

	int getTotalTime() {
		int totalTime = 0;
		int maxLoss = 0;
		for (int time : times) {
			totalTime += time;
		}
		for (int loss : losses) {
			totalTime += loss;
			if (loss > maxLoss) {
				maxLoss = loss;
			}
		}
		totalTime -= maxLoss;
		return totalTime;
	}
} Dishes ArrayList<Integer> times = new ArrayList<Integer>(); times new ArrayList<Integer>() ArrayList<Integer> losses = new ArrayList<>(); losses new ArrayList<>() Dishes(int... times) {
		for (int t : times) {
			this.times.add(t);
			int loss = (10 - t % 10) % 10;
			losses.add(loss);
		}
	} Dishes {
		for (int t : times) {
			this.times.add(t);
			int loss = (10 - t % 10) % 10;
			losses.add(loss);
		}
	} for (int t : times) {
			this.times.add(t);
			int loss = (10 - t % 10) % 10;
			losses.add(loss);
		} int t times {
			this.times.add(t);
			int loss = (10 - t % 10) % 10;
			losses.add(loss);
		} {
			this.times.add(t);
			int loss = (10 - t % 10) % 10;
			losses.add(loss);
		} this.times.add(t) this.times.add this.times this this.times t int loss = (10 - t % 10) % 10; loss (10 - t % 10) % 10 (10 - t % 10) 10 t % 10 t 10 10 losses.add(loss) losses.add losses loss int... times times int getTotalTime() {
		int totalTime = 0;
		int maxLoss = 0;
		for (int time : times) {
			totalTime += time;
		}
		for (int loss : losses) {
			totalTime += loss;
			if (loss > maxLoss) {
				maxLoss = loss;
			}
		}
		totalTime -= maxLoss;
		return totalTime;
	} getTotalTime {
		int totalTime = 0;
		int maxLoss = 0;
		for (int time : times) {
			totalTime += time;
		}
		for (int loss : losses) {
			totalTime += loss;
			if (loss > maxLoss) {
				maxLoss = loss;
			}
		}
		totalTime -= maxLoss;
		return totalTime;
	} int totalTime = 0; totalTime 0 int maxLoss = 0; maxLoss 0 for (int time : times) {
			totalTime += time;
		} int time times {
			totalTime += time;
		} {
			totalTime += time;
		} totalTime += time totalTime time for (int loss : losses) {
			totalTime += loss;
			if (loss > maxLoss) {
				maxLoss = loss;
			}
		} int loss losses {
			totalTime += loss;
			if (loss > maxLoss) {
				maxLoss = loss;
			}
		} {
			totalTime += loss;
			if (loss > maxLoss) {
				maxLoss = loss;
			}
		} totalTime += loss totalTime loss if (loss > maxLoss) {
				maxLoss = loss;
			} loss > maxLoss loss maxLoss {
				maxLoss = loss;
			} maxLoss = loss maxLoss loss totalTime -= maxLoss totalTime maxLoss return totalTime; totalTime public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		Dishes dishes = new Dishes(a, b, c, d, e);
		System.out.println(dishes.getTotalTime());
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		Dishes dishes = new Dishes(a, b, c, d, e);
		System.out.println(dishes.getTotalTime());
	}

} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		Dishes dishes = new Dishes(a, b, c, d, e);
		System.out.println(dishes.getTotalTime());
	}

}

class Dishes {
	ArrayList<Integer> times = new ArrayList<Integer>();
	ArrayList<Integer> losses = new ArrayList<>();

	Dishes(int... times) {
		for (int t : times) {
			this.times.add(t);
			int loss = (10 - t % 10) % 10;
			losses.add(loss);
		}
	}

	int getTotalTime() {
		int totalTime = 0;
		int maxLoss = 0;
		for (int time : times) {
			totalTime += time;
		}
		for (int loss : losses) {
			totalTime += loss;
			if (loss > maxLoss) {
				maxLoss = loss;
			}
		}
		totalTime -= maxLoss;
		return totalTime;
	}
}