import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] foods = new int[5];
        for(int i = 0 ; i < 5 ; i++){
            foods[i] = sc.nextInt();
        }
        sc.close();

        int[] yobun = new int[5];
        
        for(int k = 0 ; k < 5 ; k++){
            for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            }
        }
        Arrays.sort(yobun);
        int ans = 0;

        for(int i = 0; i < 5 ; i++){
            ans += foods[i];
            ans += yobun[i];
        }
        System.out.println(ans-yobun[4]);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] foods = new int[5];
        for(int i = 0 ; i < 5 ; i++){
            foods[i] = sc.nextInt();
        }
        sc.close();

        int[] yobun = new int[5];
        
        for(int k = 0 ; k < 5 ; k++){
            for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            }
        }
        Arrays.sort(yobun);
        int ans = 0;

        for(int i = 0; i < 5 ; i++){
            ans += foods[i];
            ans += yobun[i];
        }
        System.out.println(ans-yobun[4]);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] foods = new int[5];
        for(int i = 0 ; i < 5 ; i++){
            foods[i] = sc.nextInt();
        }
        sc.close();

        int[] yobun = new int[5];
        
        for(int k = 0 ; k < 5 ; k++){
            for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            }
        }
        Arrays.sort(yobun);
        int ans = 0;

        for(int i = 0; i < 5 ; i++){
            ans += foods[i];
            ans += yobun[i];
        }
        System.out.println(ans-yobun[4]);
    } main {
        Scanner sc = new Scanner(System.in);

        int[] foods = new int[5];
        for(int i = 0 ; i < 5 ; i++){
            foods[i] = sc.nextInt();
        }
        sc.close();

        int[] yobun = new int[5];
        
        for(int k = 0 ; k < 5 ; k++){
            for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            }
        }
        Arrays.sort(yobun);
        int ans = 0;

        for(int i = 0; i < 5 ; i++){
            ans += foods[i];
            ans += yobun[i];
        }
        System.out.println(ans-yobun[4]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] foods = new int[5]; foods new int[5] 5 for(int i = 0 ; i < 5 ; i++){
            foods[i] = sc.nextInt();
        } int i = 0 ; int i = 0 ; i 0 i < 5 i 5 i++ i++ i {
            foods[i] = sc.nextInt();
        } {
            foods[i] = sc.nextInt();
        } foods[i] = sc.nextInt() foods[i] foods i sc.nextInt() sc.nextInt sc sc.close() sc.close sc int[] yobun = new int[5]; yobun new int[5] 5 for(int k = 0 ; k < 5 ; k++){
            for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            }
        } int k = 0 ; int k = 0 ; k 0 k < 5 k 5 k++ k++ k {
            for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            }
        } {
            for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            }
        } for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            } int i = 10 ; int i = 10 ; i 10 i < 140 i 140 i+=10 i+=10 i 10 {
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            } {
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            } if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                } i-foods[k]>0 && i-foods[k]!=10 i-foods[k]>0 i-foods[k] i foods[k] foods k 0 i-foods[k]!=10 i-foods[k] i foods[k] foods k 10 {
                    yobun[k] = i-foods[k];
                    break;
                } yobun[k] = i-foods[k] yobun[k] yobun k i-foods[k] i foods[k] foods k break; if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                } i-foods[k]==10 i-foods[k] i foods[k] foods k 10 {
                    yobun[k] = 0 ;
                    break;
                } yobun[k] = 0 yobun[k] yobun k 0 break; Arrays.sort(yobun) Arrays.sort Arrays yobun int ans = 0; ans 0 for(int i = 0; i < 5 ; i++){
            ans += foods[i];
            ans += yobun[i];
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            ans += foods[i];
            ans += yobun[i];
        } {
            ans += foods[i];
            ans += yobun[i];
        } ans += foods[i] ans foods[i] foods i ans += yobun[i] ans yobun[i] yobun i System.out.println(ans-yobun[4]) System.out.println System.out System System.out ans-yobun[4] ans yobun[4] yobun 4 String[] args args
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] foods = new int[5];
        for(int i = 0 ; i < 5 ; i++){
            foods[i] = sc.nextInt();
        }
        sc.close();

        int[] yobun = new int[5];
        
        for(int k = 0 ; k < 5 ; k++){
            for(int i = 10 ;i < 140 ; i+=10){
                if(i-foods[k]>0 && i-foods[k]!=10){
                    yobun[k] = i-foods[k];
                    break;
                }else if(i-foods[k]==10){
                    yobun[k] = 0 ;
                    break;
                }
            }
        }
        Arrays.sort(yobun);
        int ans = 0;

        for(int i = 0; i < 5 ; i++){
            ans += foods[i];
            ans += yobun[i];
        }
        System.out.println(ans-yobun[4]);
    }
}