import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = 5;
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int tmp = 0;
        int tmp2 = 10 - (array[0] % 10);
        for (int i = 0; i < n; i++) {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        }
        count += array[tmp];
        
        System.out.println(count);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = 5;
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int tmp = 0;
        int tmp2 = 10 - (array[0] % 10);
        for (int i = 0; i < n; i++) {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        }
        count += array[tmp];
        
        System.out.println(count);
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = 5;
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int tmp = 0;
        int tmp2 = 10 - (array[0] % 10);
        for (int i = 0; i < n; i++) {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        }
        count += array[tmp];
        
        System.out.println(count);
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = 5;
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int tmp = 0;
        int tmp2 = 10 - (array[0] % 10);
        for (int i = 0; i < n; i++) {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        }
        count += array[tmp];
        
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = 5; n 5 int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            array[i] = sc.nextInt();
        } {
            array[i] = sc.nextInt();
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc int tmp = 0; tmp 0 int tmp2 = 10 - (array[0] % 10); tmp2 10 - (array[0] % 10) 10 (array[0] % 10) array[0] array 0 10 for (int i = 0; i < n; i++) {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        } {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        } if (array[i] % 10 == 0) continue; array[i] % 10 == 0 array[i] % 10 array[i] array i 10 0 continue; if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            } tmp2 < 10 - (array[i] % 10) tmp2 10 - (array[i] % 10) 10 (array[i] % 10) array[i] array i 10 {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            } tmp2 = 10 - (array[i] % 10) tmp2 10 - (array[i] % 10) 10 (array[i] % 10) array[i] array i 10 tmp = i tmp i int count = 0; count 0 for (int i = 0; i < n; i++) {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        } {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        } if (tmp == i) continue; tmp == i tmp i continue; if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            } array[i] % 10 != 0 array[i] % 10 array[i] array i 10 0 {
                array[i] += 10 - (array[i] % 10);
            } array[i] += 10 - (array[i] % 10) array[i] array i 10 - (array[i] % 10) 10 (array[i] % 10) array[i] array i 10 count += array[i] count array[i] array i count += array[tmp] count array[tmp] array tmp System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = 5;
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int tmp = 0;
        int tmp2 = 10 - (array[0] % 10);
        for (int i = 0; i < n; i++) {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        }
        count += array[tmp];
        
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = 5;
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int tmp = 0;
        int tmp2 = 10 - (array[0] % 10);
        for (int i = 0; i < n; i++) {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        }
        count += array[tmp];
        
        System.out.println(count);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = 5;
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        int tmp = 0;
        int tmp2 = 10 - (array[0] % 10);
        for (int i = 0; i < n; i++) {
            if (array[i] % 10 == 0) continue;
            if (tmp2 < 10 - (array[i] % 10)) {
                tmp2 = 10 - (array[i] % 10);
                tmp = i;
            }
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (tmp == i) continue;
            if (array[i] % 10 != 0) {
                array[i] += 10 - (array[i] % 10);
            }
            count += array[i];
        }
        count += array[tmp];
        
        System.out.println(count);
    }
}
