import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc =new Scanner(System.in);
		int a[] =new int[5];
		int b[] =new int[5];
		int sum=0;
		int min=0;
		for(int i=0;i<5;i++) {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		}
		
		System.out.println(sum-min);

}
}


 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc =new Scanner(System.in);
		int a[] =new int[5];
		int b[] =new int[5];
		int sum=0;
		int min=0;
		for(int i=0;i<5;i++) {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		}
		
		System.out.println(sum-min);

}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc =new Scanner(System.in);
		int a[] =new int[5];
		int b[] =new int[5];
		int sum=0;
		int min=0;
		for(int i=0;i<5;i++) {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		}
		
		System.out.println(sum-min);

} main {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc =new Scanner(System.in);
		int a[] =new int[5];
		int b[] =new int[5];
		int sum=0;
		int min=0;
		for(int i=0;i<5;i++) {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		}
		
		System.out.println(sum-min);

} Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int a[] =new int[5]; a new int[5] 5 int b[] =new int[5]; b new int[5] 5 int sum=0; sum 0 int min=0; min 0 for(int i=0;i<5;i++) {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		} {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		} a[i]=sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc b[i]=a[i]+9 b[i] b i a[i]+9 a[i] a i 9 b[i]=b[i]-b[i]%10 b[i] b i b[i]-b[i]%10 b[i] b i b[i]%10 b[i] b i 10 sum+=b[i] sum b[i] b i min = Math.max(min, b[i]-a[i]) min Math.max(min, b[i]-a[i]) Math.max Math min b[i]-a[i] b[i] b i a[i] a i System.out.println(sum-min) System.out.println System.out System System.out sum-min sum min String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc =new Scanner(System.in);
		int a[] =new int[5];
		int b[] =new int[5];
		int sum=0;
		int min=0;
		for(int i=0;i<5;i++) {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		}
		
		System.out.println(sum-min);

}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc =new Scanner(System.in);
		int a[] =new int[5];
		int b[] =new int[5];
		int sum=0;
		int min=0;
		for(int i=0;i<5;i++) {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		}
		
		System.out.println(sum-min);

}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc =new Scanner(System.in);
		int a[] =new int[5];
		int b[] =new int[5];
		int sum=0;
		int min=0;
		for(int i=0;i<5;i++) {
			a[i]=sc.nextInt();
			b[i]=a[i]+9;
			b[i]=b[i]-b[i]%10;
			sum+=b[i];
			min = Math.max(min, b[i]-a[i]);

		}
		
		System.out.println(sum-min);

}
}



