import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    //1の位が0,9,8,7,6,5,4,3,2,1の順に優先して頼むのが良い
    //かかる時間はそれぞれ10で割った商+リードタイムの数
    int a1 = a%10;
    int b1 = b%10;
    int c1 = c%10;
    int d1 = d%10;
    int e1 = e%10;
    int a2 = a/10;
    int b2 = b/10;
    int c2 = c/10;
    int d2 = d/10;
    int e2 = e/10;
    int answer = (a2+b2+c2+d2+e2)*10;
    //0の数カウント
    int zeroCnt=0;
    int one[] = new int[5];
    one[0]=a1;
    one[1]=b1;
    one[2]=c1;
    one[3]=d1;
    one[4]=e1;
    for(int i=0;i<5;i++){
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    }
    //答えはmax(0,(0じゃない数-1))*10を足して、0じゃない数で一番小さい数を足したもの
    Arrays.sort(one);
    if(one[0]==10){
      one[0]=0;
    }
    answer=answer+Math.max(0,4-zeroCnt)*10+one[0];
    System.out.println(answer);
  }
  

  
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    //1の位が0,9,8,7,6,5,4,3,2,1の順に優先して頼むのが良い
    //かかる時間はそれぞれ10で割った商+リードタイムの数
    int a1 = a%10;
    int b1 = b%10;
    int c1 = c%10;
    int d1 = d%10;
    int e1 = e%10;
    int a2 = a/10;
    int b2 = b/10;
    int c2 = c/10;
    int d2 = d/10;
    int e2 = e/10;
    int answer = (a2+b2+c2+d2+e2)*10;
    //0の数カウント
    int zeroCnt=0;
    int one[] = new int[5];
    one[0]=a1;
    one[1]=b1;
    one[2]=c1;
    one[3]=d1;
    one[4]=e1;
    for(int i=0;i<5;i++){
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    }
    //答えはmax(0,(0じゃない数-1))*10を足して、0じゃない数で一番小さい数を足したもの
    Arrays.sort(one);
    if(one[0]==10){
      one[0]=0;
    }
    answer=answer+Math.max(0,4-zeroCnt)*10+one[0];
    System.out.println(answer);
  }
  

  
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    //1の位が0,9,8,7,6,5,4,3,2,1の順に優先して頼むのが良い
    //かかる時間はそれぞれ10で割った商+リードタイムの数
    int a1 = a%10;
    int b1 = b%10;
    int c1 = c%10;
    int d1 = d%10;
    int e1 = e%10;
    int a2 = a/10;
    int b2 = b/10;
    int c2 = c/10;
    int d2 = d/10;
    int e2 = e/10;
    int answer = (a2+b2+c2+d2+e2)*10;
    //0の数カウント
    int zeroCnt=0;
    int one[] = new int[5];
    one[0]=a1;
    one[1]=b1;
    one[2]=c1;
    one[3]=d1;
    one[4]=e1;
    for(int i=0;i<5;i++){
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    }
    //答えはmax(0,(0じゃない数-1))*10を足して、0じゃない数で一番小さい数を足したもの
    Arrays.sort(one);
    if(one[0]==10){
      one[0]=0;
    }
    answer=answer+Math.max(0,4-zeroCnt)*10+one[0];
    System.out.println(answer);
  } main {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    //1の位が0,9,8,7,6,5,4,3,2,1の順に優先して頼むのが良い
    //かかる時間はそれぞれ10で割った商+リードタイムの数
    int a1 = a%10;
    int b1 = b%10;
    int c1 = c%10;
    int d1 = d%10;
    int e1 = e%10;
    int a2 = a/10;
    int b2 = b/10;
    int c2 = c/10;
    int d2 = d/10;
    int e2 = e/10;
    int answer = (a2+b2+c2+d2+e2)*10;
    //0の数カウント
    int zeroCnt=0;
    int one[] = new int[5];
    one[0]=a1;
    one[1]=b1;
    one[2]=c1;
    one[3]=d1;
    one[4]=e1;
    for(int i=0;i<5;i++){
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    }
    //答えはmax(0,(0じゃない数-1))*10を足して、0じゃない数で一番小さい数を足したもの
    Arrays.sort(one);
    if(one[0]==10){
      one[0]=0;
    }
    answer=answer+Math.max(0,4-zeroCnt)*10+one[0];
    System.out.println(answer);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc int a1 = a%10; a1 a%10 a 10 int b1 = b%10; b1 b%10 b 10 int c1 = c%10; c1 c%10 c 10 int d1 = d%10; d1 d%10 d 10 int e1 = e%10; e1 e%10 e 10 int a2 = a/10; a2 a/10 a 10 int b2 = b/10; b2 b/10 b 10 int c2 = c/10; c2 c/10 c 10 int d2 = d/10; d2 d/10 d 10 int e2 = e/10; e2 e/10 e 10 int answer = (a2+b2+c2+d2+e2)*10; answer (a2+b2+c2+d2+e2)*10 (a2+b2+c2+d2+e2) d2 c2 a2+b2+c2+d2+e2 a2 b2 c2 d2 e2 10 int zeroCnt=0; zeroCnt 0 int one[] = new int[5]; one new int[5] 5 one[0]=a1 one[0] one 0 a1 one[1]=b1 one[1] one 1 b1 one[2]=c1 one[2] one 2 c1 one[3]=d1 one[3] one 3 d1 one[4]=e1 one[4] one 4 e1 for(int i=0;i<5;i++){
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    } {
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    } if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      } one[i]==0 one[i] one i 0 {
        one[i]=10;
        zeroCnt++;
      } one[i]=10 one[i] one i 10 zeroCnt++ zeroCnt Arrays.sort(one) Arrays.sort Arrays one if(one[0]==10){
      one[0]=0;
    } one[0]==10 one[0] one 0 10 {
      one[0]=0;
    } one[0]=0 one[0] one 0 0 answer=answer+Math.max(0,4-zeroCnt)*10+one[0] answer answer+Math.max(0,4-zeroCnt)*10+one[0] answer+Math.max(0,4-zeroCnt)*10+one[0] answer Math.max(0,4-zeroCnt)*10 Math.max(0,4-zeroCnt) Math.max Math 0 4-zeroCnt 4 zeroCnt 10 one[0] one 0 System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    //1の位が0,9,8,7,6,5,4,3,2,1の順に優先して頼むのが良い
    //かかる時間はそれぞれ10で割った商+リードタイムの数
    int a1 = a%10;
    int b1 = b%10;
    int c1 = c%10;
    int d1 = d%10;
    int e1 = e%10;
    int a2 = a/10;
    int b2 = b/10;
    int c2 = c/10;
    int d2 = d/10;
    int e2 = e/10;
    int answer = (a2+b2+c2+d2+e2)*10;
    //0の数カウント
    int zeroCnt=0;
    int one[] = new int[5];
    one[0]=a1;
    one[1]=b1;
    one[2]=c1;
    one[3]=d1;
    one[4]=e1;
    for(int i=0;i<5;i++){
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    }
    //答えはmax(0,(0じゃない数-1))*10を足して、0じゃない数で一番小さい数を足したもの
    Arrays.sort(one);
    if(one[0]==10){
      one[0]=0;
    }
    answer=answer+Math.max(0,4-zeroCnt)*10+one[0];
    System.out.println(answer);
  }
  

  
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    //1の位が0,9,8,7,6,5,4,3,2,1の順に優先して頼むのが良い
    //かかる時間はそれぞれ10で割った商+リードタイムの数
    int a1 = a%10;
    int b1 = b%10;
    int c1 = c%10;
    int d1 = d%10;
    int e1 = e%10;
    int a2 = a/10;
    int b2 = b/10;
    int c2 = c/10;
    int d2 = d/10;
    int e2 = e/10;
    int answer = (a2+b2+c2+d2+e2)*10;
    //0の数カウント
    int zeroCnt=0;
    int one[] = new int[5];
    one[0]=a1;
    one[1]=b1;
    one[2]=c1;
    one[3]=d1;
    one[4]=e1;
    for(int i=0;i<5;i++){
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    }
    //答えはmax(0,(0じゃない数-1))*10を足して、0じゃない数で一番小さい数を足したもの
    Arrays.sort(one);
    if(one[0]==10){
      one[0]=0;
    }
    answer=answer+Math.max(0,4-zeroCnt)*10+one[0];
    System.out.println(answer);
  }
  

  
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    //1の位が0,9,8,7,6,5,4,3,2,1の順に優先して頼むのが良い
    //かかる時間はそれぞれ10で割った商+リードタイムの数
    int a1 = a%10;
    int b1 = b%10;
    int c1 = c%10;
    int d1 = d%10;
    int e1 = e%10;
    int a2 = a/10;
    int b2 = b/10;
    int c2 = c/10;
    int d2 = d/10;
    int e2 = e/10;
    int answer = (a2+b2+c2+d2+e2)*10;
    //0の数カウント
    int zeroCnt=0;
    int one[] = new int[5];
    one[0]=a1;
    one[1]=b1;
    one[2]=c1;
    one[3]=d1;
    one[4]=e1;
    for(int i=0;i<5;i++){
      if(one[i]==0){
        one[i]=10;
        zeroCnt++;
      }
    }
    //答えはmax(0,(0じゃない数-1))*10を足して、0じゃない数で一番小さい数を足したもの
    Arrays.sort(one);
    if(one[0]==10){
      one[0]=0;
    }
    answer=answer+Math.max(0,4-zeroCnt)*10+one[0];
    System.out.println(answer);
  }
  

  
}