
import java.util.Scanner;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        
        int longestWait = 10;
        int wait = 0;
        
        for (int i = 0; i < 5; i ++) {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        }
        
        System.out.println(wait - 10 + longestWait);
        
    }
    
} import java.util.Scanner; Scanner java.util public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        
        int longestWait = 10;
        int wait = 0;
        
        for (int i = 0; i < 5; i ++) {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        }
        
        System.out.println(wait - 10 + longestWait);
        
    }
    
} Main /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        
        int longestWait = 10;
        int wait = 0;
        
        for (int i = 0; i < 5; i ++) {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        }
        
        System.out.println(wait - 10 + longestWait);
        
    } main {
        
        Scanner s = new Scanner(System.in);
        
        int longestWait = 10;
        int wait = 0;
        
        for (int i = 0; i < 5; i ++) {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        }
        
        System.out.println(wait - 10 + longestWait);
        
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int longestWait = 10; longestWait 10 int wait = 0; wait 0 for (int i = 0; i < 5; i ++) {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        } int i = 0; int i = 0; i 0 i < 5 i 5 i ++ i ++ i {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        } {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        } int in = s.nextInt(); in s.nextInt() s.nextInt s wait += 10 * (int) Math.ceil((double) in / 10) wait 10 * (int) Math.ceil((double) in / 10) 10 (int) Math.ceil((double) in / 10) Math.ceil Math (double) in / 10 (double) in 10 if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10; in % 10 < longestWait && in % 10 != 0 in % 10 < longestWait in % 10 in 10 longestWait in % 10 != 0 in % 10 in 10 0 longestWait = in % 10 longestWait in % 10 in 10 System.out.println(wait - 10 + longestWait) System.out.println System.out System System.out wait - 10 + longestWait wait - 10 wait 10 longestWait String[] args args public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        
        int longestWait = 10;
        int wait = 0;
        
        for (int i = 0; i < 5; i ++) {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        }
        
        System.out.println(wait - 10 + longestWait);
        
    }
    
} public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        
        int longestWait = 10;
        int wait = 0;
        
        for (int i = 0; i < 5; i ++) {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        }
        
        System.out.println(wait - 10 + longestWait);
        
    }
    
} Main

import java.util.Scanner;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        
        int longestWait = 10;
        int wait = 0;
        
        for (int i = 0; i < 5; i ++) {
            int in = s.nextInt();
            wait += 10 * (int) Math.ceil((double) in / 10);
            if (in % 10 < longestWait && in % 10 != 0)
                longestWait = in % 10;
        }
        
        System.out.println(wait - 10 + longestWait);
        
    }
    
}
