import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int time = 0;
        ArrayList<Integer> List = new ArrayList<>();
        ArrayList<Integer> List_r = new ArrayList<>();
        for(int i=0;i<5;i++){
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        }

        while(List.size()!=0){
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        }
        System.out.println(time);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int time = 0;
        ArrayList<Integer> List = new ArrayList<>();
        ArrayList<Integer> List_r = new ArrayList<>();
        for(int i=0;i<5;i++){
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        }

        while(List.size()!=0){
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        }
        System.out.println(time);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int time = 0;
        ArrayList<Integer> List = new ArrayList<>();
        ArrayList<Integer> List_r = new ArrayList<>();
        for(int i=0;i<5;i++){
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        }

        while(List.size()!=0){
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        }
        System.out.println(time);
    } main {
        Scanner sc = new Scanner(System.in);
        int time = 0;
        ArrayList<Integer> List = new ArrayList<>();
        ArrayList<Integer> List_r = new ArrayList<>();
        for(int i=0;i<5;i++){
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        }

        while(List.size()!=0){
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        }
        System.out.println(time);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int time = 0; time 0 ArrayList<Integer> List = new ArrayList<>(); List new ArrayList<>() ArrayList<Integer> List_r = new ArrayList<>(); List_r new ArrayList<>() for(int i=0;i<5;i++){
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        } {
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        } int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            } num%10==0 num%10 num 10 0 time+=num time num {
                List.add(num);
                List_r.add(num%10);
            } List.add(num) List.add List num List_r.add(num%10) List_r.add List_r num%10 num 10 while(List.size()!=0){
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        } List.size()!=0 List.size() List.size List 0 {
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        } int num = Collections.max(List_r); num Collections.max(List_r) Collections.max Collections List_r int num2 = List_r.indexOf(num); num2 List_r.indexOf(num) List_r.indexOf List_r num if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            } num==0 num 0 time+= List.get(num2) time List.get(num2) List.get List num2 {
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            } if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2); List.size()!=1 List.size() List.size List 1 time+= List.get(num2)+(10-num) time List.get(num2)+(10-num) List.get(num2) List.get List num2 (10-num) 10 num time+= List.get(num2) time List.get(num2) List.get List num2 List.remove(num2) List.remove List num2 List_r.remove(List_r.indexOf(num)) List_r.remove List_r List_r.indexOf(num) List_r.indexOf List_r num System.out.println(time) System.out.println System.out System System.out time String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int time = 0;
        ArrayList<Integer> List = new ArrayList<>();
        ArrayList<Integer> List_r = new ArrayList<>();
        for(int i=0;i<5;i++){
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        }

        while(List.size()!=0){
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        }
        System.out.println(time);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int time = 0;
        ArrayList<Integer> List = new ArrayList<>();
        ArrayList<Integer> List_r = new ArrayList<>();
        for(int i=0;i<5;i++){
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        }

        while(List.size()!=0){
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        }
        System.out.println(time);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int time = 0;
        ArrayList<Integer> List = new ArrayList<>();
        ArrayList<Integer> List_r = new ArrayList<>();
        for(int i=0;i<5;i++){
            int num = sc.nextInt();
            if(num%10==0) time+=num;
            else {
                List.add(num);
                List_r.add(num%10);
            }

        }

        while(List.size()!=0){
            int num = Collections.max(List_r);
            int num2 = List_r.indexOf(num);
            if(num==0) time+= List.get(num2);
            else{
                if(List.size()!=1)time+= List.get(num2)+(10-num);
                else time+= List.get(num2);
            }
            List.remove(num2);
            List_r.remove(List_r.indexOf(num));
        }
        System.out.println(time);
    }
}
