import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int tmp = 10,ans = 0;
		for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		}
		System.out.println(ans-(10-tmp));
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int tmp = 10,ans = 0;
		for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		}
		System.out.println(ans-(10-tmp));
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int tmp = 10,ans = 0;
		for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		}
		System.out.println(ans-(10-tmp));
	} main {
		Scanner sc = new Scanner(System.in);
		int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int tmp = 10,ans = 0;
		for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		}
		System.out.println(ans-(10-tmp));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()}; ary {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()} sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc int tmp = 10 tmp 10 ans = 0; ans 0 for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		} int i ary {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		} {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		} ans+=i ans i while(ans%10 != 0) ans++; ans%10 != 0 ans%10 ans 10 0 ans++ ans if(tmp > i%10 && i%10 !=0) tmp=i%10; tmp > i%10 && i%10 !=0 tmp > i%10 tmp i%10 i 10 i%10 !=0 i%10 i 10 0 tmp=i%10 tmp i%10 i 10 System.out.println(ans-(10-tmp)) System.out.println System.out System System.out ans-(10-tmp) ans (10-tmp) 10 tmp String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int tmp = 10,ans = 0;
		for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		}
		System.out.println(ans-(10-tmp));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int tmp = 10,ans = 0;
		for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		}
		System.out.println(ans-(10-tmp));
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] ary = {sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int tmp = 10,ans = 0;
		for (int i : ary) {
			ans+=i;
			while(ans%10 != 0) ans++;
			if(tmp > i%10 && i%10 !=0) tmp=i%10;
		}
		System.out.println(ans-(10-tmp));
	}
}
