import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int[] data = new int[5];
		for(int i = 0;i < 5;i++){
			data[i] = sc.nextInt();
		}
		
		int index = 0;
		int min = 10;
		for(int i = 0;i < 5;i++){
			int sub = data[i] % 10;
			
			if(sub < min && sub != 0){
				index = i;
				min = sub;
			}
			
		}
		
		int ans = 0;
		for(int i = 0;i < 5;i++){
			if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			}
			ans += data[i];
		}
		System.out.print(ans );
		

	}
	


}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}

 import java.util.Scanner; Scanner java.util class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int[] data = new int[5];
		for(int i = 0;i < 5;i++){
			data[i] = sc.nextInt();
		}
		
		int index = 0;
		int min = 10;
		for(int i = 0;i < 5;i++){
			int sub = data[i] % 10;
			
			if(sub < min && sub != 0){
				index = i;
				min = sub;
			}
			
		}
		
		int ans = 0;
		for(int i = 0;i < 5;i++){
			if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			}
			ans += data[i];
		}
		System.out.print(ans );
		

	}
	


} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int[] data = new int[5];
		for(int i = 0;i < 5;i++){
			data[i] = sc.nextInt();
		}
		
		int index = 0;
		int min = 10;
		for(int i = 0;i < 5;i++){
			int sub = data[i] % 10;
			
			if(sub < min && sub != 0){
				index = i;
				min = sub;
			}
			
		}
		
		int ans = 0;
		for(int i = 0;i < 5;i++){
			if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			}
			ans += data[i];
		}
		System.out.print(ans );
		

	} main {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int[] data = new int[5];
		for(int i = 0;i < 5;i++){
			data[i] = sc.nextInt();
		}
		
		int index = 0;
		int min = 10;
		for(int i = 0;i < 5;i++){
			int sub = data[i] % 10;
			
			if(sub < min && sub != 0){
				index = i;
				min = sub;
			}
			
		}
		
		int ans = 0;
		for(int i = 0;i < 5;i++){
			if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			}
			ans += data[i];
		}
		System.out.print(ans );
		

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] data = new int[5]; data new int[5] 5 for(int i = 0;i < 5;i++){
			data[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			data[i] = sc.nextInt();
		} {
			data[i] = sc.nextInt();
		} data[i] = sc.nextInt() data[i] data i sc.nextInt() sc.nextInt sc int index = 0; index 0 int min = 10; min 10 for(int i = 0;i < 5;i++){
			int sub = data[i] % 10;
			
			if(sub < min && sub != 0){
				index = i;
				min = sub;
			}
			
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			int sub = data[i] % 10;
			
			if(sub < min && sub != 0){
				index = i;
				min = sub;
			}
			
		} {
			int sub = data[i] % 10;
			
			if(sub < min && sub != 0){
				index = i;
				min = sub;
			}
			
		} int sub = data[i] % 10; sub data[i] % 10 data[i] data i 10 if(sub < min && sub != 0){
				index = i;
				min = sub;
			} sub < min && sub != 0 sub < min sub min sub != 0 sub 0 {
				index = i;
				min = sub;
			} index = i index i min = sub min sub int ans = 0; ans 0 for(int i = 0;i < 5;i++){
			if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			}
			ans += data[i];
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			}
			ans += data[i];
		} {
			if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			}
			ans += data[i];
		} if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			} i != index i index {
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			} while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				} data[i] % 10 != 0 data[i] % 10 data[i] data i 10 0 {
					data[i] = data[i] + 1;
				} data[i] = data[i] + 1 data[i] data i data[i] + 1 data[i] data i 1 ans += data[i] ans data[i] data i System.out.print(ans ) System.out.print System.out System System.out ans String[] args args class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
} Pair int from; from int end; end @Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	} compareTo {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	} Pair otherpair = (Pair)other; otherpair (Pair)other return from - otherpair.from; from - otherpair.from from otherpair.from otherpair otherpair.from Object other other Comparable
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int[] data = new int[5];
		for(int i = 0;i < 5;i++){
			data[i] = sc.nextInt();
		}
		
		int index = 0;
		int min = 10;
		for(int i = 0;i < 5;i++){
			int sub = data[i] % 10;
			
			if(sub < min && sub != 0){
				index = i;
				min = sub;
			}
			
		}
		
		int ans = 0;
		for(int i = 0;i < 5;i++){
			if(i != index){
				while(data[i] % 10 != 0){
					data[i] = data[i] + 1;
				}
			}
			ans += data[i];
		}
		System.out.print(ans );
		

	}
	


}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}


