import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static final long M = 998_244_353;

    // 13:29-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        }
    }
} import java.io.BufferedInputStream; BufferedInputStream java.io import java.io.BufferedOutputStream; BufferedOutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {

    private static final long M = 998_244_353;

    // 13:29-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        }
    }
} Main private static final long M = 998_244_353; M 998_244_353 // 13:29-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        }
    } main {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        }
    } try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        } {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        } BufferedInputStream in = new BufferedInputStream(System.in) BufferedInputStream in = new BufferedInputStream(System.in) new BufferedInputStream(System.in) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) new PrintWriter(new BufferedOutputStream(System.out)) Scanner sc = new Scanner(in); sc new Scanner(in) int last = 0; last 0 int total = 0; total 0 for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            } {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc total += (x + 9) / 10 * 10 total (x + 9) / 10 * 10 (x + 9) / 10 (x + 9) x 9 10 10 if (x % 10 != 0) last = Math.max(last, 10 - x % 10); x % 10 != 0 x % 10 x 10 0 last = Math.max(last, 10 - x % 10) last Math.max(last, 10 - x % 10) Math.max Math last 10 - x % 10 10 x % 10 x 10 out.println(total - last) out.println out total - last total last String[] args args public class Main {

    private static final long M = 998_244_353;

    // 13:29-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        }
    }
} public class Main {

    private static final long M = 998_244_353;

    // 13:29-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        }
    }
} Main
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static final long M = 998_244_353;

    // 13:29-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int last = 0;
            int total = 0;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                total += (x + 9) / 10 * 10;
                if (x % 10 != 0) last = Math.max(last, 10 - x % 10);
            }

            out.println(total - last);
        }
    }
}
