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[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        }
    }
} 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[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        }
    }
} 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[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        }
    } main {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        }
    } try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            int[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        } {

            Scanner sc = new Scanner(in);

            int[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        } 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[] times = new int[5]; times new int[5] 5 int[] actual = new int[5]; actual new int[5] 5 int maxDiff = Integer.MIN_VALUE; maxDiff Integer.MIN_VALUE Integer Integer.MIN_VALUE int diffPos = -1; diffPos -1 1 for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            } {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc actual[i] = x actual[i] actual i x int sum = 0; sum 0 sum += x / 10 * 10 sum x / 10 * 10 x / 10 x 10 10 if (x % 10 > 0) sum += 10; x % 10 > 0 x % 10 x 10 0 sum += 10 sum 10 times[i] = sum times[i] times i sum int diff = sum - x; diff sum - x sum x if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                } diff > maxDiff diff maxDiff {
                    maxDiff = diff;
                    diffPos = i;
                } maxDiff = diff maxDiff diff diffPos = i diffPos i int total = 0; total 0 for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i]; int i = 0; int i = 0; i 0 i < times.length i times.length times times.length i++ i++ i if (i != diffPos) total += times[i]; if (i != diffPos) total += times[i]; i != diffPos i diffPos total += times[i] total times[i] times i out.println(total + actual[diffPos]) out.println out total + actual[diffPos] total actual[diffPos] actual diffPos 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[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        }
    }
} 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[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        }
    }
} 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[] times = new int[5];
            int[] actual = new int[5];
            int maxDiff = Integer.MIN_VALUE;
            int diffPos = -1;
            for (int i = 0; i < 5; i++) {
                int x = sc.nextInt();
                actual[i] = x;
                int sum = 0;
                sum += x / 10 * 10;
                if (x % 10 > 0) sum += 10;
                times[i] = sum;
                int diff = sum - x;
                if (diff > maxDiff) {
                    maxDiff = diff;
                    diffPos = i;
                }
            }

            int total = 0;
            for (int i = 0; i < times.length; i++) if (i != diffPos) total += times[i];

            out.println(total + actual[diffPos]);
        }
    }
}
