import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int[] array = new int[5];
      int[] mod = new int[5];
      int re = 0;
		for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        }
      
      int x = 11;
      for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      }
      System.out.println(re-10+x);
    }
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int[] array = new int[5];
      int[] mod = new int[5];
      int re = 0;
		for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        }
      
      int x = 11;
      for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      }
      System.out.println(re-10+x);
    }
} Main public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int[] array = new int[5];
      int[] mod = new int[5];
      int re = 0;
		for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        }
      
      int x = 11;
      for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      }
      System.out.println(re-10+x);
    } main {
    	Scanner sc = new Scanner(System.in);
      int[] array = new int[5];
      int[] mod = new int[5];
      int re = 0;
		for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        }
      
      int x = 11;
      for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      }
      System.out.println(re-10+x);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] array = new int[5]; array new int[5] 5 int[] mod = new int[5]; mod new int[5] 5 int re = 0; re 0 for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        } {
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc mod[i] = array[i]%10 mod[i] mod i array[i]%10 array[i] array i 10 if(mod[i] == 0){
            	mod[i] = 10;
          } mod[i] == 0 mod[i] mod i 0 {
            	mod[i] = 10;
          } mod[i] = 10 mod[i] mod i 10 re = re + array[i] + 10 - mod[i] re re + array[i] + 10 - mod[i] re + array[i] + 10 re + array[i] + 10 re array[i] array i 10 mod[i] mod i int x = 11; x 11 for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
      	x = Math.min(x,mod[i]);
      } {
      	x = Math.min(x,mod[i]);
      } x = Math.min(x,mod[i]) x Math.min(x,mod[i]) Math.min Math x mod[i] mod i System.out.println(re-10+x) System.out.println System.out System System.out re-10+x re-10 re 10 x String[] args args public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int[] array = new int[5];
      int[] mod = new int[5];
      int re = 0;
		for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        }
      
      int x = 11;
      for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      }
      System.out.println(re-10+x);
    }
} public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int[] array = new int[5];
      int[] mod = new int[5];
      int re = 0;
		for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        }
      
      int x = 11;
      for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      }
      System.out.println(re-10+x);
    }
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int[] array = new int[5];
      int[] mod = new int[5];
      int re = 0;
		for(int i = 0;i < 5;i++){
          array[i] = sc.nextInt();
          mod[i] = array[i]%10;
          if(mod[i] == 0){
            	mod[i] = 10;
          }
          re = re + array[i] + 10 - mod[i];
        }
      
      int x = 11;
      for(int i = 0;i < 5;i++){
      	x = Math.min(x,mod[i]);
      }
      System.out.println(re-10+x);
    }
}