import java.util.*;

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

class Solver {

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

    private int getNextOrderTime(int time) {
        return time + getDiff(time);
    }

    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 idx = 0;
        int max = 0;
        for (int i = 0; i < 5; i++) {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        }

        int time = 0;
        for (int i = 0; i < 5; i++) {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        }
        System.out.println(time);

        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 getDiff(int time) {
        return (10 - time % 10) % 10;
    }

    private int getNextOrderTime(int time) {
        return time + getDiff(time);
    }

    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 idx = 0;
        int max = 0;
        for (int i = 0; i < 5; i++) {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        }

        int time = 0;
        for (int i = 0; i < 5; i++) {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        }
        System.out.println(time);

        return;
    }

} Solver private int getDiff(int time) {
        return (10 - time % 10) % 10;
    } getDiff {
        return (10 - time % 10) % 10;
    } return (10 - time % 10) % 10; (10 - time % 10) % 10 (10 - time % 10) 10 time % 10 time 10 10 int time time private int getNextOrderTime(int time) {
        return time + getDiff(time);
    } getNextOrderTime {
        return time + getDiff(time);
    } return time + getDiff(time); time + getDiff(time) time getDiff(time) getDiff time int time time 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 idx = 0;
        int max = 0;
        for (int i = 0; i < 5; i++) {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        }

        int time = 0;
        for (int i = 0; i < 5; i++) {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        }
        System.out.println(time);

        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 idx = 0;
        int max = 0;
        for (int i = 0; i < 5; i++) {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        }

        int time = 0;
        for (int i = 0; i < 5; i++) {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        }
        System.out.println(time);

        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 idx = 0; idx 0 int max = 0; max 0 for (int i = 0; i < 5; i++) {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        } {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        } int diff = getDiff(A.get(i)); diff getDiff(A.get(i)) getDiff A.get(i) A.get A i if (max < diff) {
                max = diff;
                idx = i;
            } max < diff max diff {
                max = diff;
                idx = i;
            } max = diff max diff idx = i idx i int time = 0; time 0 for (int i = 0; i < 5; i++) {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        } {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        } if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            } i == idx i idx {
                time += A.get(i);
            } time += A.get(i) time A.get(i) A.get A i {
                time += getNextOrderTime(A.get(i));
            } time += getNextOrderTime(A.get(i)) time getNextOrderTime(A.get(i)) getNextOrderTime A.get(i) A.get A i System.out.println(time) System.out.println System.out System System.out time return;
import java.util.*;

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

class Solver {

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

    private int getNextOrderTime(int time) {
        return time + getDiff(time);
    }

    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 idx = 0;
        int max = 0;
        for (int i = 0; i < 5; i++) {
            int diff = getDiff(A.get(i));
            if (max < diff) {
                max = diff;
                idx = i;
            }
        }

        int time = 0;
        for (int i = 0; i < 5; i++) {
            if (i == idx) {
                time += A.get(i);
            } else {
                time += getNextOrderTime(A.get(i));
            }
        }
        System.out.println(time);

        return;
    }

}