import java.util.Scanner;

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

	int[] x_ = new int[5];
	int[] y_ = new int[5];

	for(int i = 0; i < 5; i++){
	    x_[i] = scan.nextInt();
	}

	for(int i = 0; i < 5; i++){
	    y_[i] = x_[i] % 10;
	}

	int diff = 10;
	int diff_num = -1;
	for(int i = 0; i < 5; i++){
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	}

	int sum = 0;
	for(int i = 0; i < 5; i++){
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	}

	System.out.println(sum);
    }
}
    import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int[] x_ = new int[5];
	int[] y_ = new int[5];

	for(int i = 0; i < 5; i++){
	    x_[i] = scan.nextInt();
	}

	for(int i = 0; i < 5; i++){
	    y_[i] = x_[i] % 10;
	}

	int diff = 10;
	int diff_num = -1;
	for(int i = 0; i < 5; i++){
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	}

	int sum = 0;
	for(int i = 0; i < 5; i++){
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	}

	System.out.println(sum);
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int[] x_ = new int[5];
	int[] y_ = new int[5];

	for(int i = 0; i < 5; i++){
	    x_[i] = scan.nextInt();
	}

	for(int i = 0; i < 5; i++){
	    y_[i] = x_[i] % 10;
	}

	int diff = 10;
	int diff_num = -1;
	for(int i = 0; i < 5; i++){
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	}

	int sum = 0;
	for(int i = 0; i < 5; i++){
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	}

	System.out.println(sum);
    } main {
	Scanner scan = new Scanner(System.in);

	int[] x_ = new int[5];
	int[] y_ = new int[5];

	for(int i = 0; i < 5; i++){
	    x_[i] = scan.nextInt();
	}

	for(int i = 0; i < 5; i++){
	    y_[i] = x_[i] % 10;
	}

	int diff = 10;
	int diff_num = -1;
	for(int i = 0; i < 5; i++){
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	}

	int sum = 0;
	for(int i = 0; i < 5; i++){
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	}

	System.out.println(sum);
    } Scanner scan = new Scanner(System.in); scan 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] = scan.nextInt();
	} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
	    x_[i] = scan.nextInt();
	} {
	    x_[i] = scan.nextInt();
	} x_[i] = scan.nextInt() x_[i] x_ i scan.nextInt() scan.nextInt scan for(int i = 0; i < 5; i++){
	    y_[i] = x_[i] % 10;
	} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
	    y_[i] = x_[i] % 10;
	} {
	    y_[i] = x_[i] % 10;
	} y_[i] = x_[i] % 10 y_[i] y_ i x_[i] % 10 x_[i] x_ i 10 int diff = 10; diff 10 int diff_num = -1; diff_num -1 1 for(int i = 0; i < 5; i++){
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	} {
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	} if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    } diff > y_[i] && y_[i] != 0 diff > y_[i] diff y_[i] y_ i y_[i] != 0 y_[i] y_ i 0 {
		diff = y_[i];
		diff_num = i;
	    } diff = y_[i] diff y_[i] y_ i diff_num = i diff_num i int sum = 0; sum 0 for(int i = 0; i < 5; i++){
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	} {
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	} if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    } diff_num == i || y_[i] == 0 diff_num == i diff_num i y_[i] == 0 y_[i] y_ i 0 {
		sum += x_[i];
	    } sum += x_[i] sum x_[i] x_ i {
		sum += x_[i]+(10-y_[i]);
	    } sum += x_[i]+(10-y_[i]) sum x_[i]+(10-y_[i]) x_[i] x_ i (10-y_[i]) 10 y_[i] y_ i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int[] x_ = new int[5];
	int[] y_ = new int[5];

	for(int i = 0; i < 5; i++){
	    x_[i] = scan.nextInt();
	}

	for(int i = 0; i < 5; i++){
	    y_[i] = x_[i] % 10;
	}

	int diff = 10;
	int diff_num = -1;
	for(int i = 0; i < 5; i++){
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	}

	int sum = 0;
	for(int i = 0; i < 5; i++){
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	}

	System.out.println(sum);
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int[] x_ = new int[5];
	int[] y_ = new int[5];

	for(int i = 0; i < 5; i++){
	    x_[i] = scan.nextInt();
	}

	for(int i = 0; i < 5; i++){
	    y_[i] = x_[i] % 10;
	}

	int diff = 10;
	int diff_num = -1;
	for(int i = 0; i < 5; i++){
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	}

	int sum = 0;
	for(int i = 0; i < 5; i++){
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	}

	System.out.println(sum);
    }
} Main
import java.util.Scanner;

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

	int[] x_ = new int[5];
	int[] y_ = new int[5];

	for(int i = 0; i < 5; i++){
	    x_[i] = scan.nextInt();
	}

	for(int i = 0; i < 5; i++){
	    y_[i] = x_[i] % 10;
	}

	int diff = 10;
	int diff_num = -1;
	for(int i = 0; i < 5; i++){
	    if(diff > y_[i] && y_[i] != 0){
		diff = y_[i];
		diff_num = i;
	    }
	}

	int sum = 0;
	for(int i = 0; i < 5; i++){
	    if(diff_num == i || y_[i] == 0){
		sum += x_[i];
	    }else{
		sum += x_[i]+(10-y_[i]);
	    }
	}

	System.out.println(sum);
    }
}
   
