import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] time = new int[5],
              wait = new int[5];
        int total = 0;
        for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        }
        int idx = maxIdx(wait);
        total -= wait[idx];                
        System.out.println(total);
    }
    public static int maxIdx(int[] wait){
        int idx = 0,
            data = wait[0];
        for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        }
        return idx;
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] time = new int[5],
              wait = new int[5];
        int total = 0;
        for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        }
        int idx = maxIdx(wait);
        total -= wait[idx];                
        System.out.println(total);
    }
    public static int maxIdx(int[] wait){
        int idx = 0,
            data = wait[0];
        for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        }
        return idx;
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] time = new int[5],
              wait = new int[5];
        int total = 0;
        for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        }
        int idx = maxIdx(wait);
        total -= wait[idx];                
        System.out.println(total);
    } main {
        Scanner sc = new Scanner(System.in);
        int[] time = new int[5],
              wait = new int[5];
        int total = 0;
        for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        }
        int idx = maxIdx(wait);
        total -= wait[idx];                
        System.out.println(total);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] time = new int[5] time new int[5] 5 wait = new int[5]; wait new int[5] 5 int total = 0; total 0 for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        } {
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        } time[i] = sc.nextInt() time[i] time i sc.nextInt() sc.nextInt sc wait[i] = (10 - time[i]%10)%10 wait[i] wait i (10 - time[i]%10)%10 (10 - time[i]%10) 10 time[i]%10 time[i] time i 10 10 total += time[i] + wait[i] total time[i] + wait[i] time[i] time i wait[i] wait i int idx = maxIdx(wait); idx maxIdx(wait) maxIdx wait total -= wait[idx] total wait[idx] wait idx System.out.println(total) System.out.println System.out System System.out total String[] args args public static int maxIdx(int[] wait){
        int idx = 0,
            data = wait[0];
        for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        }
        return idx;
    } maxIdx {
        int idx = 0,
            data = wait[0];
        for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        }
        return idx;
    } int idx = 0 idx 0 data = wait[0]; data wait[0] wait 0 for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        } int i = 1; int i = 1; i 1 i < 5 i 5 i++ i++ i {
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        } {
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        } if(data < wait[i]){
                data = wait[i];
                idx = i;
            } data < wait[i] data wait[i] wait i {
                data = wait[i];
                idx = i;
            } data = wait[i] data wait[i] wait i idx = i idx i return idx; idx int[] wait wait public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] time = new int[5],
              wait = new int[5];
        int total = 0;
        for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        }
        int idx = maxIdx(wait);
        total -= wait[idx];                
        System.out.println(total);
    }
    public static int maxIdx(int[] wait){
        int idx = 0,
            data = wait[0];
        for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        }
        return idx;
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] time = new int[5],
              wait = new int[5];
        int total = 0;
        for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        }
        int idx = maxIdx(wait);
        total -= wait[idx];                
        System.out.println(total);
    }
    public static int maxIdx(int[] wait){
        int idx = 0,
            data = wait[0];
        for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        }
        return idx;
    }
} Main
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] time = new int[5],
              wait = new int[5];
        int total = 0;
        for(int i = 0; i < 5; i++){
            time[i] = sc.nextInt();
            wait[i] = (10 - time[i]%10)%10;
            total += time[i] + wait[i];
        }
        int idx = maxIdx(wait);
        total -= wait[idx];                
        System.out.println(total);
    }
    public static int maxIdx(int[] wait){
        int idx = 0,
            data = wait[0];
        for(int i = 1; i < 5; i++){
            if(data < wait[i]){
                data = wait[i];
                idx = i;
            }
        }
        return idx;
    }
}