import java.util.*;
public class Main{
public static void main(String arg[]){
	Scanner sc=new Scanner(System.in);
	int a[]=new int[5];
	int b[]=new int[5];
	int c=0,s=0;
	for(int i=0;i<5;i++){
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	}
	Arrays.sort(b);
	for(int i=0;i<4;i++){
	if(b[i]!=0)
	s=s+b[i];
	}
	System.out.println(s);
}
} import java.util.*; util.* java public class Main{
public static void main(String arg[]){
	Scanner sc=new Scanner(System.in);
	int a[]=new int[5];
	int b[]=new int[5];
	int c=0,s=0;
	for(int i=0;i<5;i++){
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	}
	Arrays.sort(b);
	for(int i=0;i<4;i++){
	if(b[i]!=0)
	s=s+b[i];
	}
	System.out.println(s);
}
} Main public static void main(String arg[]){
	Scanner sc=new Scanner(System.in);
	int a[]=new int[5];
	int b[]=new int[5];
	int c=0,s=0;
	for(int i=0;i<5;i++){
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	}
	Arrays.sort(b);
	for(int i=0;i<4;i++){
	if(b[i]!=0)
	s=s+b[i];
	}
	System.out.println(s);
} main {
	Scanner sc=new Scanner(System.in);
	int a[]=new int[5];
	int b[]=new int[5];
	int c=0,s=0;
	for(int i=0;i<5;i++){
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	}
	Arrays.sort(b);
	for(int i=0;i<4;i++){
	if(b[i]!=0)
	s=s+b[i];
	}
	System.out.println(s);
} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int a[]=new int[5]; a new int[5] 5 int b[]=new int[5]; b new int[5] 5 int c=0 c 0 s=0; s 0 for(int i=0;i<5;i++){
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	} {
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	} a[i]=sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc s=s+a[i] s s+a[i] s a[i] a i if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		} a[i]%10!=0 a[i]%10 a[i] a i 10 0 {
			b[c]=10-(a[i]%10);
		c++;
		} b[c]=10-(a[i]%10) b[c] b c 10-(a[i]%10) 10 (a[i]%10) a[i] a i 10 c++ c Arrays.sort(b) Arrays.sort Arrays b for(int i=0;i<4;i++){
	if(b[i]!=0)
	s=s+b[i];
	} int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
	if(b[i]!=0)
	s=s+b[i];
	} {
	if(b[i]!=0)
	s=s+b[i];
	} if(b[i]!=0)
	s=s+b[i]; b[i]!=0 b[i] b i 0 s=s+b[i] s s+b[i] s b[i] b i System.out.println(s) System.out.println System.out System System.out s String arg[] arg public class Main{
public static void main(String arg[]){
	Scanner sc=new Scanner(System.in);
	int a[]=new int[5];
	int b[]=new int[5];
	int c=0,s=0;
	for(int i=0;i<5;i++){
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	}
	Arrays.sort(b);
	for(int i=0;i<4;i++){
	if(b[i]!=0)
	s=s+b[i];
	}
	System.out.println(s);
}
} public class Main{
public static void main(String arg[]){
	Scanner sc=new Scanner(System.in);
	int a[]=new int[5];
	int b[]=new int[5];
	int c=0,s=0;
	for(int i=0;i<5;i++){
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	}
	Arrays.sort(b);
	for(int i=0;i<4;i++){
	if(b[i]!=0)
	s=s+b[i];
	}
	System.out.println(s);
}
} Main
import java.util.*;
public class Main{
public static void main(String arg[]){
	Scanner sc=new Scanner(System.in);
	int a[]=new int[5];
	int b[]=new int[5];
	int c=0,s=0;
	for(int i=0;i<5;i++){
		 a[i]=sc.nextInt();
		s=s+a[i];
		if(a[i]%10!=0){
			b[c]=10-(a[i]%10);
		c++;
		}
	}
	Arrays.sort(b);
	for(int i=0;i<4;i++){
	if(b[i]!=0)
	s=s+b[i];
	}
	System.out.println(s);
}
}