import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[5];
        int ans = 0;
        int max = 0;
        for(int i = 0;i<5;i++){
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        }
        System.out.println(ans - max);
    }
} 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 ans = 0;
        int max = 0;
        for(int i = 0;i<5;i++){
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        }
        System.out.println(ans - max);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[5];
        int ans = 0;
        int max = 0;
        for(int i = 0;i<5;i++){
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        }
        System.out.println(ans - max);
    } main {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[5];
        int ans = 0;
        int max = 0;
        for(int i = 0;i<5;i++){
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        }
        System.out.println(ans - max);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a[] = new int[5]; a new int[5] 5 int ans = 0; ans 0 int max = 0; max 0 for(int i = 0;i<5;i++){
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        } int i = 0; int i = 0; i 0 i<5 i 5 i++ i++ i {
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        } {
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc ans += a[i] + 10 - a[i] % 10 ans a[i] + 10 - a[i] % 10 a[i] + 10 a[i] a i 10 a[i] % 10 a[i] a i 10 if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            } a[i] % 10 != 0 a[i] % 10 a[i] a i 10 0 {
                max = Math.max(max,10 - a[i] % 10);
            } max = Math.max(max,10 - a[i] % 10) max Math.max(max,10 - a[i] % 10) Math.max Math max 10 - a[i] % 10 10 a[i] % 10 a[i] a i 10 {
                ans -=10;
            } ans -=10 ans 10 System.out.println(ans - max) System.out.println System.out System System.out ans - max ans max String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[5];
        int ans = 0;
        int max = 0;
        for(int i = 0;i<5;i++){
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        }
        System.out.println(ans - max);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[5];
        int ans = 0;
        int max = 0;
        for(int i = 0;i<5;i++){
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        }
        System.out.println(ans - max);
    }
} 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 ans = 0;
        int max = 0;
        for(int i = 0;i<5;i++){
            a[i] = sc.nextInt();
            sc.nextLine();
            
            ans += a[i] + 10 - a[i] % 10;
            if(a[i] % 10 != 0){
                max = Math.max(max,10 - a[i] % 10);
            }else{
                ans -=10;
            }
        }
        System.out.println(ans - max);
    }
}