import java.util.*;
public class Main{
  public static void main(String[] args){
   	Scanner sc = new Scanner(System.in);
 
    int Na = sc.nextInt();
    int Nb = sc.nextInt();
    int Nc = sc.nextInt();
    int Nd = sc.nextInt();
    int Ne = sc.nextInt();
    
    int count = 0;
    int[] N1 = new int[5];
    N1[0] = Na%10;
    N1[1] = Nb%10;
    N1[2] = Nc%10;
    N1[3] = Nd%10;
    N1[4] = Ne%10;
    
    int sum = Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40;
    
    Arrays.sort(N1);
    int min = 0;
    for(int i = 0; i<5;i++)
    {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    }
    if(count == 5) count = 4;
   	System.out.println(sum - 10 * count +min);
 }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
   	Scanner sc = new Scanner(System.in);
 
    int Na = sc.nextInt();
    int Nb = sc.nextInt();
    int Nc = sc.nextInt();
    int Nd = sc.nextInt();
    int Ne = sc.nextInt();
    
    int count = 0;
    int[] N1 = new int[5];
    N1[0] = Na%10;
    N1[1] = Nb%10;
    N1[2] = Nc%10;
    N1[3] = Nd%10;
    N1[4] = Ne%10;
    
    int sum = Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40;
    
    Arrays.sort(N1);
    int min = 0;
    for(int i = 0; i<5;i++)
    {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    }
    if(count == 5) count = 4;
   	System.out.println(sum - 10 * count +min);
 }
} Main public static void main(String[] args){
   	Scanner sc = new Scanner(System.in);
 
    int Na = sc.nextInt();
    int Nb = sc.nextInt();
    int Nc = sc.nextInt();
    int Nd = sc.nextInt();
    int Ne = sc.nextInt();
    
    int count = 0;
    int[] N1 = new int[5];
    N1[0] = Na%10;
    N1[1] = Nb%10;
    N1[2] = Nc%10;
    N1[3] = Nd%10;
    N1[4] = Ne%10;
    
    int sum = Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40;
    
    Arrays.sort(N1);
    int min = 0;
    for(int i = 0; i<5;i++)
    {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    }
    if(count == 5) count = 4;
   	System.out.println(sum - 10 * count +min);
 } main {
   	Scanner sc = new Scanner(System.in);
 
    int Na = sc.nextInt();
    int Nb = sc.nextInt();
    int Nc = sc.nextInt();
    int Nd = sc.nextInt();
    int Ne = sc.nextInt();
    
    int count = 0;
    int[] N1 = new int[5];
    N1[0] = Na%10;
    N1[1] = Nb%10;
    N1[2] = Nc%10;
    N1[3] = Nd%10;
    N1[4] = Ne%10;
    
    int sum = Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40;
    
    Arrays.sort(N1);
    int min = 0;
    for(int i = 0; i<5;i++)
    {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    }
    if(count == 5) count = 4;
   	System.out.println(sum - 10 * count +min);
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int Na = sc.nextInt(); Na sc.nextInt() sc.nextInt sc int Nb = sc.nextInt(); Nb sc.nextInt() sc.nextInt sc int Nc = sc.nextInt(); Nc sc.nextInt() sc.nextInt sc int Nd = sc.nextInt(); Nd sc.nextInt() sc.nextInt sc int Ne = sc.nextInt(); Ne sc.nextInt() sc.nextInt sc int count = 0; count 0 int[] N1 = new int[5]; N1 new int[5] 5 N1[0] = Na%10 N1[0] N1 0 Na%10 Na 10 N1[1] = Nb%10 N1[1] N1 1 Nb%10 Nb 10 N1[2] = Nc%10 N1[2] N1 2 Nc%10 Nc 10 N1[3] = Nd%10 N1[3] N1 3 Nd%10 Nd 10 N1[4] = Ne%10 N1[4] N1 4 Ne%10 Ne 10 int sum = Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40; sum Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40 Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4] Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3] Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd Na-N1[0]+Nb-N1[1]+Nc-N1[2] Na-N1[0]+Nb-N1[1]+Nc Na-N1[0]+Nb-N1[1] Na-N1[0]+Nb Na-N1[0] Na N1[0] N1 0 Nb N1[1] N1 1 Nc N1[2] N1 2 Nd N1[3] N1 3 Ne N1[4] N1 4 40 Arrays.sort(N1) Arrays.sort Arrays N1 int min = 0; min 0 for(int i = 0; i<5;i++)
    {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    } int i = 0; int i = 0; i 0 i<5 i 5 i++ i++ i {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    } {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    } if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        } N1[i] == 0 N1[i] N1 i 0 count++ count {
          min = N1[i];
          break;
        } min = N1[i] min N1[i] N1 i break; if(count == 5) count = 4; count == 5 count 5 count = 4 count 4 System.out.println(sum - 10 * count +min) System.out.println System.out System System.out sum - 10 * count +min sum - 10 * count sum 10 * count 10 count min String[] args args public class Main{
  public static void main(String[] args){
   	Scanner sc = new Scanner(System.in);
 
    int Na = sc.nextInt();
    int Nb = sc.nextInt();
    int Nc = sc.nextInt();
    int Nd = sc.nextInt();
    int Ne = sc.nextInt();
    
    int count = 0;
    int[] N1 = new int[5];
    N1[0] = Na%10;
    N1[1] = Nb%10;
    N1[2] = Nc%10;
    N1[3] = Nd%10;
    N1[4] = Ne%10;
    
    int sum = Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40;
    
    Arrays.sort(N1);
    int min = 0;
    for(int i = 0; i<5;i++)
    {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    }
    if(count == 5) count = 4;
   	System.out.println(sum - 10 * count +min);
 }
} public class Main{
  public static void main(String[] args){
   	Scanner sc = new Scanner(System.in);
 
    int Na = sc.nextInt();
    int Nb = sc.nextInt();
    int Nc = sc.nextInt();
    int Nd = sc.nextInt();
    int Ne = sc.nextInt();
    
    int count = 0;
    int[] N1 = new int[5];
    N1[0] = Na%10;
    N1[1] = Nb%10;
    N1[2] = Nc%10;
    N1[3] = Nd%10;
    N1[4] = Ne%10;
    
    int sum = Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40;
    
    Arrays.sort(N1);
    int min = 0;
    for(int i = 0; i<5;i++)
    {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    }
    if(count == 5) count = 4;
   	System.out.println(sum - 10 * count +min);
 }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
   	Scanner sc = new Scanner(System.in);
 
    int Na = sc.nextInt();
    int Nb = sc.nextInt();
    int Nc = sc.nextInt();
    int Nd = sc.nextInt();
    int Ne = sc.nextInt();
    
    int count = 0;
    int[] N1 = new int[5];
    N1[0] = Na%10;
    N1[1] = Nb%10;
    N1[2] = Nc%10;
    N1[3] = Nd%10;
    N1[4] = Ne%10;
    
    int sum = Na-N1[0]+Nb-N1[1]+Nc-N1[2]+Nd-N1[3]+Ne-N1[4]+40;
    
    Arrays.sort(N1);
    int min = 0;
    for(int i = 0; i<5;i++)
    {
    	if(N1[i] == 0) count++;
      	else 
        {
          min = N1[i];
          break;
        }
    }
    if(count == 5) count = 4;
   	System.out.println(sum - 10 * count +min);
 }
}