import java.util.Scanner;

class Main {

    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);

	int x[] = new int[5];
	int y[] = new int[5];
	for (int i = 0; i < 5; i++) {
	    x[i] = sc.nextInt();
	    y[i] = x[i] % 10;
	}

	for (int i = 0; i < 4; i++) {
            for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    }
	}

	int count = 0;
	int z = 4;
	while (y[z] == 0) {
	    count += x[z];
	    z--;
	    if (z == -1)
		break;
	}
	
	int k;
	for (k = 0; k < z; k++)
	    count += (x[k] - y[k]) + 10;

	if (z != -1)
	    System.out.println(count + x[z]);
	else
	    System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util class Main {

    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);

	int x[] = new int[5];
	int y[] = new int[5];
	for (int i = 0; i < 5; i++) {
	    x[i] = sc.nextInt();
	    y[i] = x[i] % 10;
	}

	for (int i = 0; i < 4; i++) {
            for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    }
	}

	int count = 0;
	int z = 4;
	while (y[z] == 0) {
	    count += x[z];
	    z--;
	    if (z == -1)
		break;
	}
	
	int k;
	for (k = 0; k < z; k++)
	    count += (x[k] - y[k]) + 10;

	if (z != -1)
	    System.out.println(count + x[z]);
	else
	    System.out.println(count);
    }
} Main public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);

	int x[] = new int[5];
	int y[] = new int[5];
	for (int i = 0; i < 5; i++) {
	    x[i] = sc.nextInt();
	    y[i] = x[i] % 10;
	}

	for (int i = 0; i < 4; i++) {
            for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    }
	}

	int count = 0;
	int z = 4;
	while (y[z] == 0) {
	    count += x[z];
	    z--;
	    if (z == -1)
		break;
	}
	
	int k;
	for (k = 0; k < z; k++)
	    count += (x[k] - y[k]) + 10;

	if (z != -1)
	    System.out.println(count + x[z]);
	else
	    System.out.println(count);
    } main {
	Scanner sc = new Scanner(System.in);

	int x[] = new int[5];
	int y[] = new int[5];
	for (int i = 0; i < 5; i++) {
	    x[i] = sc.nextInt();
	    y[i] = x[i] % 10;
	}

	for (int i = 0; i < 4; i++) {
            for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    }
	}

	int count = 0;
	int z = 4;
	while (y[z] == 0) {
	    count += x[z];
	    z--;
	    if (z == -1)
		break;
	}
	
	int k;
	for (k = 0; k < z; k++)
	    count += (x[k] - y[k]) + 10;

	if (z != -1)
	    System.out.println(count + x[z]);
	else
	    System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x[] = new int[5]; x new int[5] 5 int y[] = new int[5]; y new int[5] 5 for (int i = 0; i < 5; i++) {
	    x[i] = sc.nextInt();
	    y[i] = x[i] % 10;
	} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
	    x[i] = sc.nextInt();
	    y[i] = x[i] % 10;
	} {
	    x[i] = sc.nextInt();
	    y[i] = x[i] % 10;
	} x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc y[i] = x[i] % 10 y[i] y i x[i] % 10 x[i] x i 10 for (int i = 0; i < 4; i++) {
            for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    }
	} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    }
	} {
            for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    }
	} for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    } int j = 4; int j = 4; j 4 j > i j i j-- j-- j {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    } {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    } if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		} y[j - 1] < y[j] y[j - 1] y j - 1 j 1 y[j] y j {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		} int tmp_x = x[j - 1]; tmp_x x[j - 1] x j - 1 j 1 x[j - 1] = x[j] x[j - 1] x j - 1 j 1 x[j] x j x[j] = tmp_x x[j] x j tmp_x int tmp_y = y[j - 1]; tmp_y y[j - 1] y j - 1 j 1 y[j - 1] = y[j] y[j - 1] y j - 1 j 1 y[j] y j y[j] = tmp_y y[j] y j tmp_y int count = 0; count 0 int z = 4; z 4 while (y[z] == 0) {
	    count += x[z];
	    z--;
	    if (z == -1)
		break;
	} y[z] == 0 y[z] y z 0 {
	    count += x[z];
	    z--;
	    if (z == -1)
		break;
	} count += x[z] count x[z] x z z-- z if (z == -1)
		break; z == -1 z -1 1 break; int k; k for (k = 0; k < z; k++)
	    count += (x[k] - y[k]) + 10; k = 0; k = 0 k 0 k < z k z k++ k++ k count += (x[k] - y[k]) + 10; count += (x[k] - y[k]) + 10 count (x[k] - y[k]) + 10 (x[k] - y[k]) x[k] x k y[k] y k 10 if (z != -1)
	    System.out.println(count + x[z]);
	else
	    System.out.println(count); z != -1 z -1 1 System.out.println(count + x[z]) System.out.println System.out System System.out count + x[z] count x[z] x z System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);

	int x[] = new int[5];
	int y[] = new int[5];
	for (int i = 0; i < 5; i++) {
	    x[i] = sc.nextInt();
	    y[i] = x[i] % 10;
	}

	for (int i = 0; i < 4; i++) {
            for (int j = 4; j > i; j--) {
		if (y[j - 1] < y[j]) {
		    int tmp_x = x[j - 1];
		    x[j - 1] = x[j];
		    x[j] = tmp_x;

		    int tmp_y = y[j - 1];
		    y[j - 1] = y[j];
		    y[j] = tmp_y;
		}
	    }
	}

	int count = 0;
	int z = 4;
	while (y[z] == 0) {
	    count += x[z];
	    z--;
	    if (z == -1)
		break;
	}
	
	int k;
	for (k = 0; k < z; k++)
	    count += (x[k] - y[k]) + 10;

	if (z != -1)
	    System.out.println(count + x[z]);
	else
	    System.out.println(count);
    }
}