import java.io.*;
import java.util.ArrayList;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        int[] dishes = new int[5];
        for (int i=0;i<5;i++){
            str = br.readLine();
            dishes[i] = Integer.parseInt(str);
        }
        ArrayList<Integer> time = new ArrayList<Integer>();
        for (int i=0;i<5;i++){
            for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            }
        }
        Integer[] ti = time.toArray(new Integer[time.size()]);
        int ans = ti[0];
        for (int i:time){
            if (i<ans){
                ans = i;
            }
        }
        System.out.println(ans);
    }
} import java.io.*; io.* java import java.util.ArrayList; ArrayList java.util class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        int[] dishes = new int[5];
        for (int i=0;i<5;i++){
            str = br.readLine();
            dishes[i] = Integer.parseInt(str);
        }
        ArrayList<Integer> time = new ArrayList<Integer>();
        for (int i=0;i<5;i++){
            for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            }
        }
        Integer[] ti = time.toArray(new Integer[time.size()]);
        int ans = ti[0];
        for (int i:time){
            if (i<ans){
                ans = i;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        int[] dishes = new int[5];
        for (int i=0;i<5;i++){
            str = br.readLine();
            dishes[i] = Integer.parseInt(str);
        }
        ArrayList<Integer> time = new ArrayList<Integer>();
        for (int i=0;i<5;i++){
            for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            }
        }
        Integer[] ti = time.toArray(new Integer[time.size()]);
        int ans = ti[0];
        for (int i:time){
            if (i<ans){
                ans = i;
            }
        }
        System.out.println(ans);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        int[] dishes = new int[5];
        for (int i=0;i<5;i++){
            str = br.readLine();
            dishes[i] = Integer.parseInt(str);
        }
        ArrayList<Integer> time = new ArrayList<Integer>();
        for (int i=0;i<5;i++){
            for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            }
        }
        Integer[] ti = time.toArray(new Integer[time.size()]);
        int ans = ti[0];
        for (int i:time){
            if (i<ans){
                ans = i;
            }
        }
        System.out.println(ans);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str; str int[] dishes = new int[5]; dishes new int[5] 5 for (int i=0;i<5;i++){
            str = br.readLine();
            dishes[i] = Integer.parseInt(str);
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            str = br.readLine();
            dishes[i] = Integer.parseInt(str);
        } {
            str = br.readLine();
            dishes[i] = Integer.parseInt(str);
        } str = br.readLine() str br.readLine() br.readLine br dishes[i] = Integer.parseInt(str) dishes[i] dishes i Integer.parseInt(str) Integer.parseInt Integer str ArrayList<Integer> time = new ArrayList<Integer>(); time new ArrayList<Integer>() for (int i=0;i<5;i++){
            for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            }
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            }
        } {
            for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            }
        } for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            } int j=0; int j=0; j 0 j<5 j 5 j++ j++ j {
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            } {
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            } if (i==j){
                    continue;
                } i==j i j {
                    continue;
                } continue; for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                } int k=0; int k=0; k 0 k<5 k 5 k++ k++ k {
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                } {
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                } if (i==k || j==k){
                        continue;
                    } i==k || j==k i==k i k j==k j k {
                        continue;
                    } continue; for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    } int l=0; int l=0; l 0 l<5 l 5 l++ l++ l {
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    } {
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    } if (i==l || j==l || k==l){
                            continue;
                        } i==l || j==l || k==l i==l || j==l || k==l i==l i l j==l j l k==l k l {
                            continue;
                        } continue; for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        } int m=0; int m=0; m 0 m<5 m 5 m++ m++ m {
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        } {
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        } if (i==m || j==m || k==m || l==m){
                                continue;
                            } i==m || j==m || k==m || l==m k==m i==m || j==m || k==m || l==m i==m i m j==m j m k==m k m l==m l m {
                                continue;
                            } continue; time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]) time.add time (dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m] (dishes[l]+9)/10*10 (dishes[k]+9)/10*10 (dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m] (dishes[i]+9)/10*10 (dishes[i]+9)/10 (dishes[i]+9) dishes[i] dishes i 9 10 10 (dishes[j]+9)/10*10 (dishes[j]+9)/10 (dishes[j]+9) dishes[j] dishes j 9 10 10 (dishes[k]+9)/10*10 (dishes[k]+9)/10 (dishes[k]+9) dishes[k] dishes k 9 10 10 (dishes[l]+9)/10*10 (dishes[l]+9)/10 (dishes[l]+9) dishes[l] dishes l 9 10 10 dishes[m] dishes m Integer[] ti = time.toArray(new Integer[time.size()]); ti time.toArray(new Integer[time.size()]) time.toArray time new Integer[time.size()] time.size() time.size time int ans = ti[0]; ans ti[0] ti 0 for (int i:time){
            if (i<ans){
                ans = i;
            }
        } int i time {
            if (i<ans){
                ans = i;
            }
        } {
            if (i<ans){
                ans = i;
            }
        } if (i<ans){
                ans = i;
            } i<ans i ans {
                ans = i;
            } ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.io.*;
import java.util.ArrayList;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        int[] dishes = new int[5];
        for (int i=0;i<5;i++){
            str = br.readLine();
            dishes[i] = Integer.parseInt(str);
        }
        ArrayList<Integer> time = new ArrayList<Integer>();
        for (int i=0;i<5;i++){
            for (int j=0;j<5;j++){
                if (i==j){
                    continue;
                }
                for (int k=0;k<5;k++){
                    if (i==k || j==k){
                        continue;
                    }
                    for (int l=0;l<5;l++){
                        if (i==l || j==l || k==l){
                            continue;
                        }
                        for (int m=0;m<5;m++){
                            if (i==m || j==m || k==m || l==m){
                                continue;
                            }
                            time.add((dishes[i]+9)/10*10 + (dishes[j]+9)/10*10 + (dishes[k]+9)/10*10 + (dishes[l]+9)/10*10 + dishes[m]);
                        }
                    }
                }
            }
        }
        Integer[] ti = time.toArray(new Integer[time.size()]);
        int ans = ti[0];
        for (int i:time){
            if (i<ans){
                ans = i;
            }
        }
        System.out.println(ans);
    }
}