import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    private int getNextOrderTime(int time) {
        return time + ((10 - time % 10) % 10);
    }

    public int calc(List<Integer> A, List<Integer> C, int min) {
        if (C.size() == 5) {
            min = Math.min(min, simulate(C));
            return min;
        }

        for (int i = 0; i < A.size(); i++) {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        }
        return min;
    }

    public int simulate(List<Integer> A) {
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        }
        return sum;
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        List<Integer> A = new LinkedList<Integer>();
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());

        int min = calc(A, new LinkedList<Integer>(), Integer.MAX_VALUE);
        System.out.println(min);

        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    private int getNextOrderTime(int time) {
        return time + ((10 - time % 10) % 10);
    }

    public int calc(List<Integer> A, List<Integer> C, int min) {
        if (C.size() == 5) {
            min = Math.min(min, simulate(C));
            return min;
        }

        for (int i = 0; i < A.size(); i++) {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        }
        return min;
    }

    public int simulate(List<Integer> A) {
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        }
        return sum;
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        List<Integer> A = new LinkedList<Integer>();
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());

        int min = calc(A, new LinkedList<Integer>(), Integer.MAX_VALUE);
        System.out.println(min);

        return;
    }

} Solver private int getNextOrderTime(int time) {
        return time + ((10 - time % 10) % 10);
    } getNextOrderTime {
        return time + ((10 - time % 10) % 10);
    } return time + ((10 - time % 10) % 10); time + ((10 - time % 10) % 10) time ((10 - time % 10) % 10) (10 - time % 10) 10 time % 10 time 10 10 int time time public int calc(List<Integer> A, List<Integer> C, int min) {
        if (C.size() == 5) {
            min = Math.min(min, simulate(C));
            return min;
        }

        for (int i = 0; i < A.size(); i++) {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        }
        return min;
    } calc {
        if (C.size() == 5) {
            min = Math.min(min, simulate(C));
            return min;
        }

        for (int i = 0; i < A.size(); i++) {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        }
        return min;
    } if (C.size() == 5) {
            min = Math.min(min, simulate(C));
            return min;
        } C.size() == 5 C.size() C.size C 5 {
            min = Math.min(min, simulate(C));
            return min;
        } min = Math.min(min, simulate(C)) min Math.min(min, simulate(C)) Math.min Math min simulate(C) simulate C return min; min for (int i = 0; i < A.size(); i++) {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        } int i = 0; int i = 0; i 0 i < A.size() i A.size() A.size A i++ i++ i {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        } {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        } List<Integer> a = new LinkedList<>(A); a new LinkedList<>(A) List<Integer> l = new LinkedList<>(C); l new LinkedList<>(C) int v = a.get(i); v a.get(i) a.get a i a.remove(i) a.remove a i l.add(v) l.add l v min = Math.min(min, calc(a, l, min)) min Math.min(min, calc(a, l, min)) Math.min Math min calc(a, l, min) calc a l min return min; min List<Integer> A A List<Integer> C C int min min public int simulate(List<Integer> A) {
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        }
        return sum;
    } simulate {
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        }
        return sum;
    } int sum = 0; sum 0 for (int i = 0; i < 5; i++) {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        } {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        } int time = A.get(i); time A.get(i) A.get A i if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            } i == 4 i 4 {
                sum += time;
            } sum += time sum time {
                sum += getNextOrderTime(time);
            } sum += getNextOrderTime(time) sum getNextOrderTime(time) getNextOrderTime time return sum; sum List<Integer> A A public void run() {
        Scanner sc = new Scanner(System.in);
        List<Integer> A = new LinkedList<Integer>();
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());

        int min = calc(A, new LinkedList<Integer>(), Integer.MAX_VALUE);
        System.out.println(min);

        return;
    } run {
        Scanner sc = new Scanner(System.in);
        List<Integer> A = new LinkedList<Integer>();
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());

        int min = calc(A, new LinkedList<Integer>(), Integer.MAX_VALUE);
        System.out.println(min);

        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<Integer> A = new LinkedList<Integer>(); A new LinkedList<Integer>() A.add(sc.nextInt()) A.add A sc.nextInt() sc.nextInt sc A.add(sc.nextInt()) A.add A sc.nextInt() sc.nextInt sc A.add(sc.nextInt()) A.add A sc.nextInt() sc.nextInt sc A.add(sc.nextInt()) A.add A sc.nextInt() sc.nextInt sc A.add(sc.nextInt()) A.add A sc.nextInt() sc.nextInt sc int min = calc(A, new LinkedList<Integer>(), Integer.MAX_VALUE); min calc(A, new LinkedList<Integer>(), Integer.MAX_VALUE) calc A new LinkedList<Integer>() Integer.MAX_VALUE Integer Integer.MAX_VALUE System.out.println(min) System.out.println System.out System System.out min return;
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    private int getNextOrderTime(int time) {
        return time + ((10 - time % 10) % 10);
    }

    public int calc(List<Integer> A, List<Integer> C, int min) {
        if (C.size() == 5) {
            min = Math.min(min, simulate(C));
            return min;
        }

        for (int i = 0; i < A.size(); i++) {
            List<Integer> a = new LinkedList<>(A);
            List<Integer> l = new LinkedList<>(C);
            int v = a.get(i);
            a.remove(i);
            l.add(v);
            min = Math.min(min, calc(a, l, min));
        }
        return min;
    }

    public int simulate(List<Integer> A) {
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            int time = A.get(i);
            if (i == 4) {
                sum += time;
            } else {
                sum += getNextOrderTime(time);
            }
        }
        return sum;
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        List<Integer> A = new LinkedList<Integer>();
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());
        A.add(sc.nextInt());

        int min = calc(A, new LinkedList<Integer>(), Integer.MAX_VALUE);
        System.out.println(min);

        return;
    }

}
