import 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();
        int order[] = {a,b,c,d,e};
      	Integer time[] = new Integer[order.length];
      	int total = 0;
     
      	for(int i = 0; i < order.length; ++i){
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        }
      	
      	for(int i = 0; i < time.length; ++i){
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        }
      	Arrays.sort(time);
      
      	if(time[0]!=0){
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         }else if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        }
      
    }
} import java.util.*; util.* java 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();
        int order[] = {a,b,c,d,e};
      	Integer time[] = new Integer[order.length];
      	int total = 0;
     
      	for(int i = 0; i < order.length; ++i){
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        }
      	
      	for(int i = 0; i < time.length; ++i){
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        }
      	Arrays.sort(time);
      
      	if(time[0]!=0){
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         }else if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        }
      
    }
} 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();
        int order[] = {a,b,c,d,e};
      	Integer time[] = new Integer[order.length];
      	int total = 0;
     
      	for(int i = 0; i < order.length; ++i){
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        }
      	
      	for(int i = 0; i < time.length; ++i){
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        }
      	Arrays.sort(time);
      
      	if(time[0]!=0){
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         }else if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        }
      
    } 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();
        int order[] = {a,b,c,d,e};
      	Integer time[] = new Integer[order.length];
      	int total = 0;
     
      	for(int i = 0; i < order.length; ++i){
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        }
      	
      	for(int i = 0; i < time.length; ++i){
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        }
      	Arrays.sort(time);
      
      	if(time[0]!=0){
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         }else if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        }
      
    } 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 int order[] = {a,b,c,d,e}; order {a,b,c,d,e} a b c d e Integer time[] = new Integer[order.length]; time new Integer[order.length] order.length order order.length int total = 0; total 0 for(int i = 0; i < order.length; ++i){
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        } int i = 0; int i = 0; i 0 i < order.length i order.length order order.length ++i ++i i {
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        } {
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        } time[i] = order[i]%10 time[i] time i order[i]%10 order[i] order i 10 order[i] = order[i]-time[i] order[i] order i order[i]-time[i] order[i] order i time[i] time i for(int i = 0; i < time.length; ++i){
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        } int i = 0; int i = 0; i 0 i < time.length i time.length time time.length ++i ++i i {
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        } {
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        } int amari=0; amari 0 if(time[i]!=0){
          		amari = 10-time[i];
            } time[i]!=0 time[i] time i 0 {
          		amari = 10-time[i];
            } amari = 10-time[i] amari 10-time[i] 10 time[i] time i total = total+order[i]+time[i]+amari total total+order[i]+time[i]+amari time[i] total+order[i]+time[i]+amari total order[i] order i time[i] time i amari Arrays.sort(time) Arrays.sort Arrays time if(time[0]!=0){
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         }else if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        } time[0]!=0 time[0] time 0 0 {
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         } total = total - (10-time[0]) total total - (10-time[0]) total (10-time[0]) 10 time[0] time 0 System.out.println(total) System.out.println System.out System System.out total if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        } time[1]!=0 time[1] time 1 0 {
          	total = total - (10-time[1]);
          	System.out.println(total);
         } total = total - (10-time[1]) total total - (10-time[1]) total (10-time[1]) 10 time[1] time 1 System.out.println(total) System.out.println System.out System System.out total if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        } time[2]!=0 time[2] time 2 0 {
          	total = total - (10-time[2]);
          	System.out.println(total);
         } total = total - (10-time[2]) total total - (10-time[2]) total (10-time[2]) 10 time[2] time 2 System.out.println(total) System.out.println System.out System System.out total if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        } time[3]!=0 time[3] time 3 0 {
          	total = total - (10-time[3]);
          	System.out.println(total);
         } total = total - (10-time[3]) total total - (10-time[3]) total (10-time[3]) 10 time[3] time 3 System.out.println(total) System.out.println System.out System System.out total if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        } time[4]!=0 time[4] time 4 0 {
          	total = total - (10-time[4]);
          	System.out.println(total);
         } total = total - (10-time[4]) total total - (10-time[4]) total (10-time[4]) 10 time[4] time 4 System.out.println(total) System.out.println System.out System System.out total if(time[4]==0){
          	System.out.println(total);
        } time[4]==0 time[4] time 4 0 {
          	System.out.println(total);
        } System.out.println(total) System.out.println System.out System System.out total String[] args args 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();
        int order[] = {a,b,c,d,e};
      	Integer time[] = new Integer[order.length];
      	int total = 0;
     
      	for(int i = 0; i < order.length; ++i){
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        }
      	
      	for(int i = 0; i < time.length; ++i){
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        }
      	Arrays.sort(time);
      
      	if(time[0]!=0){
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         }else if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        }
      
    }
} 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();
        int order[] = {a,b,c,d,e};
      	Integer time[] = new Integer[order.length];
      	int total = 0;
     
      	for(int i = 0; i < order.length; ++i){
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        }
      	
      	for(int i = 0; i < time.length; ++i){
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        }
      	Arrays.sort(time);
      
      	if(time[0]!=0){
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         }else if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        }
      
    }
} Main
import 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();
        int order[] = {a,b,c,d,e};
      	Integer time[] = new Integer[order.length];
      	int total = 0;
     
      	for(int i = 0; i < order.length; ++i){
        	time[i] = order[i]%10;
          	order[i] = order[i]-time[i];
        }
      	
      	for(int i = 0; i < time.length; ++i){
          int amari=0;
          	if(time[i]!=0){
          		amari = 10-time[i];
            }
          	total = total+order[i]+time[i]+amari;
        }
      	Arrays.sort(time);
      
      	if(time[0]!=0){
      		total = total - (10-time[0]);
          	 //調理時間出力
      		System.out.println(total);
         }else if(time[1]!=0){
          	total = total - (10-time[1]);
          	System.out.println(total);
         }else if(time[2]!=0){
          	total = total - (10-time[2]);
          	System.out.println(total);
         }else if(time[3]!=0){
          	total = total - (10-time[3]);
          	System.out.println(total);
         }else if(time[4]!=0){
          	total = total - (10-time[4]);
          	System.out.println(total);
         }else if(time[4]==0){
          	System.out.println(total);
        }
      
    }
}