import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 129;
        int idx = 5;
        for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        }
        int sum = 0;
        for(int i=0; i<5; i++) {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        }
        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 = new int[5];
        int min = 129;
        int idx = 5;
        for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        }
        int sum = 0;
        for(int i=0; i<5; i++) {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        }
        System.out.println(sum);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 129;
        int idx = 5;
        for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        }
        int sum = 0;
        for(int i=0; i<5; i++) {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        }
        System.out.println(sum);
    } main {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 129;
        int idx = 5;
        for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        }
        int sum = 0;
        for(int i=0; i<5; i++) {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        }
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] a = new int[5]; a new int[5] 5 int min = 129; min 129 int idx = 5; idx 5 for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        } {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        } a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            } (a[i] % 10) != 0 && (min % 10) > (a[i] % 10) (a[i] % 10) != 0 (a[i] % 10) a[i] a i 10 0 (min % 10) > (a[i] % 10) (min % 10) min 10 (a[i] % 10) a[i] a i 10 {
                min = a[i];
                idx = i;
            } min = a[i] min a[i] a i idx = i idx i if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            } (a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10) (a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10) (a[i] % 10) != 0 (a[i] % 10) a[i] a i 10 0 min > a[i] min a[i] a i (min % 10) >= (a[i] % 10) (min % 10) min 10 (a[i] % 10) a[i] a i 10 {
                min = a[i];
                idx = i;
            } min = a[i] min a[i] a i idx = i idx i int sum = 0; sum 0 for(int i=0; i<5; i++) {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        } {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        } if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            } i == idx i idx {
                sum += a[i];
            } sum += a[i] sum a[i] a i {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            } if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                } a[i] % 10 == 0 a[i] % 10 a[i] a i 10 0 {
                    sum += a[i];
                } sum += a[i] sum a[i] a i {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                } sum += a[i] sum a[i] a i sum += 10 - a[i] % 10 sum 10 - a[i] % 10 10 a[i] % 10 a[i] a i 10 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 = new int[5];
        int min = 129;
        int idx = 5;
        for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        }
        int sum = 0;
        for(int i=0; i<5; i++) {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        }
        System.out.println(sum);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 129;
        int idx = 5;
        for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        }
        int sum = 0;
        for(int i=0; i<5; i++) {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        }
        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 = new int[5];
        int min = 129;
        int idx = 5;
        for(int i=0; i<5; i++) {
            a[i] = Integer.parseInt(sc.next());
            if((a[i] % 10) != 0 && (min % 10) > (a[i] % 10)) {
                min = a[i];
                idx = i;
            }else if((a[i] % 10) != 0 && min > a[i] && (min % 10) >= (a[i] % 10)) {
                min = a[i];
                idx = i;
            }
            
        }
        int sum = 0;
        for(int i=0; i<5; i++) {
            if(i == idx) {
                sum += a[i];
            }else {
                if(a[i] % 10 == 0) {
                    sum += a[i];
                }else {
                    sum += a[i];
                    sum += 10 - a[i] % 10;
                }
            }
        }
        System.out.println(sum);
    }
}