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();
      	List<Integer> list = new ArrayList<Integer>();
        List<Integer> numList = new ArrayList<Integer>();
        list.add(a);
        list.add(b);
        list.add(c);
        list.add(d);
        list.add(e);
        int num = 0;
        int min = 10;
        int check = 0;
        for(int i=0; i<5; i++){
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        }
        int sum = 0;
        for(int i=0; i<5; i++){
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        }
        sum += (list.get(check));
     System.out.println(sum);
	}
} 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();
      	List<Integer> list = new ArrayList<Integer>();
        List<Integer> numList = new ArrayList<Integer>();
        list.add(a);
        list.add(b);
        list.add(c);
        list.add(d);
        list.add(e);
        int num = 0;
        int min = 10;
        int check = 0;
        for(int i=0; i<5; i++){
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        }
        int sum = 0;
        for(int i=0; i<5; i++){
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        }
        sum += (list.get(check));
     System.out.println(sum);
	}
} 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();
      	List<Integer> list = new ArrayList<Integer>();
        List<Integer> numList = new ArrayList<Integer>();
        list.add(a);
        list.add(b);
        list.add(c);
        list.add(d);
        list.add(e);
        int num = 0;
        int min = 10;
        int check = 0;
        for(int i=0; i<5; i++){
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        }
        int sum = 0;
        for(int i=0; i<5; i++){
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        }
        sum += (list.get(check));
     System.out.println(sum);
	} 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();
      	List<Integer> list = new ArrayList<Integer>();
        List<Integer> numList = new ArrayList<Integer>();
        list.add(a);
        list.add(b);
        list.add(c);
        list.add(d);
        list.add(e);
        int num = 0;
        int min = 10;
        int check = 0;
        for(int i=0; i<5; i++){
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        }
        int sum = 0;
        for(int i=0; i<5; i++){
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        }
        sum += (list.get(check));
     System.out.println(sum);
	} 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 List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() List<Integer> numList = new ArrayList<Integer>(); numList new ArrayList<Integer>() list.add(a) list.add list a list.add(b) list.add list b list.add(c) list.add list c list.add(d) list.add list d list.add(e) list.add list e int num = 0; num 0 int min = 10; min 10 int check = 0; check 0 for(int i=0; i<5; i++){
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        } {
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        } num = list.get(i) num list.get(i) list.get list i if(num >= 100) num = num % 100; num >= 100 num 100 num = num % 100 num num % 100 num 100 if(num >= 10) num = num % 10; num >= 10 num 10 num = num % 10 num num % 10 num 10 if(num == 0) num = 10; num == 0 num 0 num = 10 num 10 numList.add(num) numList.add numList num if(num < min) {
            min = num;
            check = i;
          } num < min num min {
            min = num;
            check = i;
          } min = num min num check = i check i int sum = 0; sum 0 for(int i=0; i<5; i++){
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        } {
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        } if(i == check) continue; i == check i check continue; sum += (list.get(i)+(10-numList.get(i))) sum (list.get(i)+(10-numList.get(i))) list.get(i) list.get list i (10-numList.get(i)) 10 numList.get(i) numList.get numList i sum += (list.get(check)) sum (list.get(check)) list.get list check System.out.println(sum) System.out.println System.out System System.out sum 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();
      	List<Integer> list = new ArrayList<Integer>();
        List<Integer> numList = new ArrayList<Integer>();
        list.add(a);
        list.add(b);
        list.add(c);
        list.add(d);
        list.add(e);
        int num = 0;
        int min = 10;
        int check = 0;
        for(int i=0; i<5; i++){
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        }
        int sum = 0;
        for(int i=0; i<5; i++){
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        }
        sum += (list.get(check));
     System.out.println(sum);
	}
} 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();
      	List<Integer> list = new ArrayList<Integer>();
        List<Integer> numList = new ArrayList<Integer>();
        list.add(a);
        list.add(b);
        list.add(c);
        list.add(d);
        list.add(e);
        int num = 0;
        int min = 10;
        int check = 0;
        for(int i=0; i<5; i++){
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        }
        int sum = 0;
        for(int i=0; i<5; i++){
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        }
        sum += (list.get(check));
     System.out.println(sum);
	}
} 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();
      	List<Integer> list = new ArrayList<Integer>();
        List<Integer> numList = new ArrayList<Integer>();
        list.add(a);
        list.add(b);
        list.add(c);
        list.add(d);
        list.add(e);
        int num = 0;
        int min = 10;
        int check = 0;
        for(int i=0; i<5; i++){
          num = list.get(i);
          if(num >= 100) num = num % 100;
          if(num >= 10) num = num % 10;
          if(num == 0) num = 10;
          numList.add(num);
          if(num < min) {
            min = num;
            check = i;
          }
        }
        int sum = 0;
        for(int i=0; i<5; i++){
          if(i == check) continue;
          sum += (list.get(i)+(10-numList.get(i)));
        }
        sum += (list.get(check));
     System.out.println(sum);
	}
}