import java.util.*;
 
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n[] = new int[5];
        int min = 0 , swap = 0 , index = 0 , sum = 0;

        for ( int i = 0 ; i < 5 ; i++ ) {
            n[i] = sc.nextInt();
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            min = 9;
            for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            }
            swap = n[i];
            n[i] = n[index];
            n[index] = swap;
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            }
        }

        System.out.println(sum);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n[] = new int[5];
        int min = 0 , swap = 0 , index = 0 , sum = 0;

        for ( int i = 0 ; i < 5 ; i++ ) {
            n[i] = sc.nextInt();
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            min = 9;
            for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            }
            swap = n[i];
            n[i] = n[index];
            n[index] = swap;
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            }
        }

        System.out.println(sum);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n[] = new int[5];
        int min = 0 , swap = 0 , index = 0 , sum = 0;

        for ( int i = 0 ; i < 5 ; i++ ) {
            n[i] = sc.nextInt();
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            min = 9;
            for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            }
            swap = n[i];
            n[i] = n[index];
            n[index] = swap;
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            }
        }

        System.out.println(sum);
    } main {
        Scanner sc = new Scanner(System.in);
        int n[] = new int[5];
        int min = 0 , swap = 0 , index = 0 , sum = 0;

        for ( int i = 0 ; i < 5 ; i++ ) {
            n[i] = sc.nextInt();
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            min = 9;
            for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            }
            swap = n[i];
            n[i] = n[index];
            n[index] = swap;
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            }
        }

        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n[] = new int[5]; n new int[5] 5 int min = 0 min 0 swap = 0 swap 0 index = 0 index 0 sum = 0; sum 0 for ( int i = 0 ; i < 5 ; i++ ) {
            n[i] = sc.nextInt();
        } int i = 0 ; int i = 0 ; i 0 i < 5 i 5 i++ i++ i {
            n[i] = sc.nextInt();
        } {
            n[i] = sc.nextInt();
        } n[i] = sc.nextInt() n[i] n i sc.nextInt() sc.nextInt sc for ( int i = 0 ; i < 5 ; i++ ) {
            min = 9;
            for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            }
            swap = n[i];
            n[i] = n[index];
            n[index] = swap;
        } int i = 0 ; int i = 0 ; i 0 i < 5 i 5 i++ i++ i {
            min = 9;
            for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            }
            swap = n[i];
            n[i] = n[index];
            n[index] = swap;
        } {
            min = 9;
            for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            }
            swap = n[i];
            n[i] = n[index];
            n[index] = swap;
        } min = 9 min 9 for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            } int j = i ; int j = i ; j i j < 5 j 5 j++ j++ j {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            } {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            } if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                } ( n[j] % 10 ) == 0 ( n[j] % 10 ) n[j] n j 10 0 {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } min = ( 10 - ( n[j] % 10 ) ) min ( 10 - ( n[j] % 10 ) ) 10 ( n[j] % 10 ) n[j] n j 10 index = j index j if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                } ( 10 - ( n[j] % 10 ) ) <= min ( 10 - ( n[j] % 10 ) ) 10 ( n[j] % 10 ) n[j] n j 10 min {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                } min = ( 10 - ( n[j] % 10 ) ) min ( 10 - ( n[j] % 10 ) ) 10 ( n[j] % 10 ) n[j] n j 10 index = j index j swap = n[i] swap n[i] n i n[i] = n[index] n[i] n i n[index] n index n[index] = swap n[index] n index swap for ( int i = 0 ; i < 5 ; i++ ) {
            if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            }
        } int i = 0 ; int i = 0 ; i 0 i < 5 i 5 i++ i++ i {
            if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            }
        } {
            if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            }
        } if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            } i < 4 i 4 { 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                } (n[i] % 10) != 0 (n[i] % 10) n[i] n i 10 0 {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } sum += n[i] sum n[i] n i sum += ( 10 - ( n[i] % 10 ) ) sum ( 10 - ( n[i] % 10 ) ) 10 ( n[i] % 10 ) n[i] n i 10 {
                    sum += n[i];
                } sum += n[i] sum n[i] n i if (i == 4) {
                sum += n[i];
            } i == 4 i 4 {
                sum += n[i];
            } sum += n[i] sum n[i] n i System.out.println(sum) System.out.println System.out System System.out sum String[] args args
import java.util.*;
 
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n[] = new int[5];
        int min = 0 , swap = 0 , index = 0 , sum = 0;

        for ( int i = 0 ; i < 5 ; i++ ) {
            n[i] = sc.nextInt();
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            min = 9;
            for ( int j = i ; j < 5 ; j++ ) {
                if (( n[j] % 10 ) == 0) {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;                    
                } else if ( ( 10 - ( n[j] % 10 ) ) <= min )  {
                    min = ( 10 - ( n[j] % 10 ) );
                    index = j;
                }
            }
            swap = n[i];
            n[i] = n[index];
            n[index] = swap;
        }

        for ( int i = 0 ; i < 5 ; i++ ) {
            if (i < 4){ 
                if ( (n[i] % 10) != 0) {
                    sum += n[i];
                    sum += ( 10 - ( n[i] % 10 ) );
                } else {
                    sum += n[i];
                }
            } else if (i == 4) {
                sum += n[i];
            }
        }

        System.out.println(sum);
    }
}