import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a[]= new int[5];
		int b[]= new int[5];
		int ans=0;
        
        for(int i=0; i<5; i++){
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        }
        
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        }
        
        for(int i=0; i<4; i++){
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        }
		
        System.out.println(ans+a[4]);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a[]= new int[5];
		int b[]= new int[5];
		int ans=0;
        
        for(int i=0; i<5; i++){
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        }
        
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        }
        
        for(int i=0; i<4; i++){
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        }
		
        System.out.println(ans+a[4]);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a[]= new int[5];
		int b[]= new int[5];
		int ans=0;
        
        for(int i=0; i<5; i++){
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        }
        
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        }
        
        for(int i=0; i<4; i++){
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        }
		
        System.out.println(ans+a[4]);
	} main {
		Scanner sc = new Scanner(System.in);
		
		int a[]= new int[5];
		int b[]= new int[5];
		int ans=0;
        
        for(int i=0; i<5; i++){
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        }
        
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        }
        
        for(int i=0; i<4; i++){
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        }
		
        System.out.println(ans+a[4]);
	} 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 ans=0; ans 0 for(int i=0; i<5; i++){
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        } {
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc b[i] = 10-a[i]%10 b[i] b i 10-a[i]%10 10 a[i]%10 a[i] a i 10 if(a[i]%10==0){
                b[i]=0;
            } a[i]%10==0 a[i]%10 a[i] a i 10 0 {
                b[i]=0;
            } b[i]=0 b[i] b i 0 for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        } int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        } {
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        } for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        } int j=0; int j=0; j 0 j<4 j 4 j++ j++ j {
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        } {
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        } if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            } b[j]>b[j+1] b[j] b j b[j+1] b j+1 j 1 {
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            } int tmp=b[j]; tmp b[j] b j b[j]=b[j+1] b[j] b j b[j+1] b j+1 j 1 b[j+1]=tmp b[j+1] b j+1 j 1 tmp tmp=a[j] tmp a[j] a j a[j]=a[j+1] a[j] a j a[j+1] a j+1 j 1 a[j+1]=tmp a[j+1] a j+1 j 1 tmp for(int i=0; i<4; i++){
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        } int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        } {
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        } if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            } a[i]%10!=0 a[i]%10 a[i] a i 10 0 {
                a[i]=a[i]+(10-a[i]%10);
            } a[i]=a[i]+(10-a[i]%10) a[i] a i a[i]+(10-a[i]%10) a[i] a i (10-a[i]%10) 10 a[i]%10 a[i] a i 10 ans+=a[i] ans a[i] a i System.out.println(ans+a[4]) System.out.println System.out System System.out ans+a[4] ans a[4] a 4 String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a[]= new int[5];
		int b[]= new int[5];
		int ans=0;
        
        for(int i=0; i<5; i++){
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        }
        
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        }
        
        for(int i=0; i<4; i++){
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        }
		
        System.out.println(ans+a[4]);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a[]= new int[5];
		int b[]= new int[5];
		int ans=0;
        
        for(int i=0; i<5; i++){
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        }
        
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        }
        
        for(int i=0; i<4; i++){
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        }
		
        System.out.println(ans+a[4]);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a[]= new int[5];
		int b[]= new int[5];
		int ans=0;
        
        for(int i=0; i<5; i++){
            a[i] = sc.nextInt();
            b[i] = 10-a[i]%10;
            if(a[i]%10==0){
                b[i]=0;
            }
        }
        
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
	            if(b[j]>b[j+1]){
	                int tmp=b[j];
	                b[j]=b[j+1];
	                b[j+1]=tmp;
	                tmp=a[j];
	                a[j]=a[j+1];
	                a[j+1]=tmp;
	            }
	        }
        }
        
        for(int i=0; i<4; i++){
            if (a[i]%10!=0){
                a[i]=a[i]+(10-a[i]%10);
            }
            ans+=a[i];
        }
		
        System.out.println(ans+a[4]);
	}
}