import java.util.*;

public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] order = new int[5];
        for (int i = 0; i < 5; i++) {
            order[i] = sc.nextInt();
        }
        
        int[] time = new int[5];
        for(int i = 0; i < 5; i++) {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        }
        int max = 0;
        int ans = 0;
        for(int i = 0; i < 5; i++) {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        }
        System.out.println(ans - max);
    }
} import java.util.*; util.* java public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] order = new int[5];
        for (int i = 0; i < 5; i++) {
            order[i] = sc.nextInt();
        }
        
        int[] time = new int[5];
        for(int i = 0; i < 5; i++) {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        }
        int max = 0;
        int ans = 0;
        for(int i = 0; i < 5; i++) {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        }
        System.out.println(ans - max);
    }
} Main public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] order = new int[5];
        for (int i = 0; i < 5; i++) {
            order[i] = sc.nextInt();
        }
        
        int[] time = new int[5];
        for(int i = 0; i < 5; i++) {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        }
        int max = 0;
        int ans = 0;
        for(int i = 0; i < 5; i++) {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        }
        System.out.println(ans - max);
    } main {
        Scanner sc = new Scanner(System.in);
        int[] order = new int[5];
        for (int i = 0; i < 5; i++) {
            order[i] = sc.nextInt();
        }
        
        int[] time = new int[5];
        for(int i = 0; i < 5; i++) {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        }
        int max = 0;
        int ans = 0;
        for(int i = 0; i < 5; i++) {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        }
        System.out.println(ans - max);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] order = new int[5]; order new int[5] 5 for (int i = 0; i < 5; i++) {
            order[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            order[i] = sc.nextInt();
        } {
            order[i] = sc.nextInt();
        } order[i] = sc.nextInt() order[i] order i sc.nextInt() sc.nextInt sc int[] time = new int[5]; time new int[5] 5 for(int i = 0; i < 5; i++) {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        } {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        } time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0) time[i] time i (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0) (order[i] / 10) * 10 (order[i] / 10) order[i] order i 10 10 (order[i] % 10 != 0 ? 10 : 0) order[i] % 10 != 0 order[i] % 10 order[i] order i 10 0 10 0 int max = 0; max 0 int ans = 0; ans 0 for(int i = 0; i < 5; i++) {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        } {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        } max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max max Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max Math.abs(time[i] - order[i]) > max Math.abs(time[i] - order[i]) Math.abs Math time[i] - order[i] time[i] time i order[i] order i max Math.abs(time[i] - order[i]) Math.abs Math time[i] - order[i] time[i] time i order[i] order i max ans += time[i] ans time[i] time i System.out.println(ans - max) System.out.println System.out System System.out ans - max ans max final String[] args args public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] order = new int[5];
        for (int i = 0; i < 5; i++) {
            order[i] = sc.nextInt();
        }
        
        int[] time = new int[5];
        for(int i = 0; i < 5; i++) {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        }
        int max = 0;
        int ans = 0;
        for(int i = 0; i < 5; i++) {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        }
        System.out.println(ans - max);
    }
} public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] order = new int[5];
        for (int i = 0; i < 5; i++) {
            order[i] = sc.nextInt();
        }
        
        int[] time = new int[5];
        for(int i = 0; i < 5; i++) {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        }
        int max = 0;
        int ans = 0;
        for(int i = 0; i < 5; i++) {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        }
        System.out.println(ans - max);
    }
} Main
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] order = new int[5];
        for (int i = 0; i < 5; i++) {
            order[i] = sc.nextInt();
        }
        
        int[] time = new int[5];
        for(int i = 0; i < 5; i++) {
            time[i] = (order[i] / 10) * 10 + (order[i] % 10 != 0 ? 10 : 0);
        }
        int max = 0;
        int ans = 0;
        for(int i = 0; i < 5; i++) {
            max = Math.abs(time[i] - order[i]) > max ? Math.abs(time[i] - order[i]) : max;
            ans += time[i];
        }
        System.out.println(ans - max);
    }
}