import java.util.Scanner;
 
class Main {
  static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
		
       int nam = 0; int min = 10;int sam = 0;
      
      for(int i=0;i<5;i++){
        nam = sc.nextInt();
         if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        }
      }
      System.out.print(sam-(10-min));
      
    }
} import java.util.Scanner; Scanner java.util class Main {
  static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
		
       int nam = 0; int min = 10;int sam = 0;
      
      for(int i=0;i<5;i++){
        nam = sc.nextInt();
         if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        }
      }
      System.out.print(sam-(10-min));
      
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		
       int nam = 0; int min = 10;int sam = 0;
      
      for(int i=0;i<5;i++){
        nam = sc.nextInt();
         if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        }
      }
      System.out.print(sam-(10-min));
      
    } main {
		
       int nam = 0; int min = 10;int sam = 0;
      
      for(int i=0;i<5;i++){
        nam = sc.nextInt();
         if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        }
      }
      System.out.print(sam-(10-min));
      
    } int nam = 0; nam 0 int min = 10; min 10 int sam = 0; sam 0 for(int i=0;i<5;i++){
        nam = sc.nextInt();
         if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        }
      } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
        nam = sc.nextInt();
         if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        }
      } {
        nam = sc.nextInt();
         if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        }
      } nam = sc.nextInt() nam sc.nextInt() sc.nextInt sc if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        } nam%10==0 nam%10 nam 10 0 {sam +=nam;} sam +=nam sam nam {
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        } min = Math.min(min,nam%10) min Math.min(min,nam%10) Math.min Math min nam%10 nam 10 sam += nam+(10-nam%10) sam nam+(10-nam%10) nam (10-nam%10) 10 nam%10 nam 10 System.out.print(sam-(10-min)) System.out.print System.out System System.out sam-(10-min) sam (10-min) 10 min String[] args args
import java.util.Scanner;
 
class Main {
  static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
		
       int nam = 0; int min = 10;int sam = 0;
      
      for(int i=0;i<5;i++){
        nam = sc.nextInt();
         if(nam%10==0){sam +=nam;}
        else{
        	min = Math.min(min,nam%10);//一番時間をとる
            sam += nam+(10-nam%10);
        }
      }
      System.out.print(sam-(10-min));
      
    }
}