import java.util.*;

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

        int ans = 0;
        int last = 10;
        for(int i = 0; i < 5; i++){
            int input = sc.nextInt();
            ans += (input - 1) / 10 + 1;
            if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            }
        }
        ans *= 10;
        ans -= 10 - last;
        System.out.println(ans);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int ans = 0;
        int last = 10;
        for(int i = 0; i < 5; i++){
            int input = sc.nextInt();
            ans += (input - 1) / 10 + 1;
            if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            }
        }
        ans *= 10;
        ans -= 10 - last;
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int ans = 0;
        int last = 10;
        for(int i = 0; i < 5; i++){
            int input = sc.nextInt();
            ans += (input - 1) / 10 + 1;
            if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            }
        }
        ans *= 10;
        ans -= 10 - last;
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        int ans = 0;
        int last = 10;
        for(int i = 0; i < 5; i++){
            int input = sc.nextInt();
            ans += (input - 1) / 10 + 1;
            if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            }
        }
        ans *= 10;
        ans -= 10 - last;
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ans = 0; ans 0 int last = 10; last 10 for(int i = 0; i < 5; i++){
            int input = sc.nextInt();
            ans += (input - 1) / 10 + 1;
            if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            int input = sc.nextInt();
            ans += (input - 1) / 10 + 1;
            if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            }
        } {
            int input = sc.nextInt();
            ans += (input - 1) / 10 + 1;
            if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            }
        } int input = sc.nextInt(); input sc.nextInt() sc.nextInt sc ans += (input - 1) / 10 + 1 ans (input - 1) / 10 + 1 (input - 1) / 10 (input - 1) input 1 10 1 if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            } input % 10 != 0 input % 10 input 10 0 {
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            } if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10); last == 0 last 0 last = input % 10 last input % 10 input 10 last = Math.min(last, input % 10) last Math.min(last, input % 10) Math.min Math last input % 10 input 10 ans *= 10 ans 10 ans -= 10 - last ans 10 - last 10 last System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

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

        int ans = 0;
        int last = 10;
        for(int i = 0; i < 5; i++){
            int input = sc.nextInt();
            ans += (input - 1) / 10 + 1;
            if(input % 10 != 0){
                if(last == 0)last = input % 10;
                else last = Math.min(last, input % 10);
            }
        }
        ans *= 10;
        ans -= 10 - last;
        System.out.println(ans);
    }
}