import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count=0;
		int max=0;
		int a=0;
		int[] A = new int[5];
		int c=0;
		
		for(int i=0;i<5;i++) {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		}
		
		for(int i=0;i<5;i++) {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		}
		
		System.out.println(count-max);
		
		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count=0;
		int max=0;
		int a=0;
		int[] A = new int[5];
		int c=0;
		
		for(int i=0;i<5;i++) {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		}
		
		for(int i=0;i<5;i++) {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		}
		
		System.out.println(count-max);
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count=0;
		int max=0;
		int a=0;
		int[] A = new int[5];
		int c=0;
		
		for(int i=0;i<5;i++) {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		}
		
		for(int i=0;i<5;i++) {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		}
		
		System.out.println(count-max);
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int count=0;
		int max=0;
		int a=0;
		int[] A = new int[5];
		int c=0;
		
		for(int i=0;i<5;i++) {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		}
		
		for(int i=0;i<5;i++) {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		}
		
		System.out.println(count-max);
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count=0; count 0 int max=0; max 0 int a=0; a 0 int[] A = new int[5]; A new int[5] 5 int c=0; c 0 for(int i=0;i<5;i++) {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		} {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		} A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				} A[i]%10!=0 A[i]%10 A[i] A i 10 0 {
				max=Math.max((10-A[i]%10), max);
				c=i;
				} max=Math.max((10-A[i]%10), max) max Math.max((10-A[i]%10), max) Math.max Math (10-A[i]%10) 10 A[i]%10 A[i] A i 10 max c=i c i for(int i=0;i<5;i++) {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		} {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		} count+=A[i] count A[i] A i for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			} int j=0; int j=0; j 0 j<9 j 9 j++ j++ j {
				if(count%10!=0) {
					count++;
				}
			} {
				if(count%10!=0) {
					count++;
				}
			} if(count%10!=0) {
					count++;
				} count%10!=0 count%10 count 10 0 {
					count++;
				} count++ count System.out.println(count-max) System.out.println System.out System System.out count-max count max sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count=0;
		int max=0;
		int a=0;
		int[] A = new int[5];
		int c=0;
		
		for(int i=0;i<5;i++) {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		}
		
		for(int i=0;i<5;i++) {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		}
		
		System.out.println(count-max);
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count=0;
		int max=0;
		int a=0;
		int[] A = new int[5];
		int c=0;
		
		for(int i=0;i<5;i++) {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		}
		
		for(int i=0;i<5;i++) {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		}
		
		System.out.println(count-max);
		
		sc.close();
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count=0;
		int max=0;
		int a=0;
		int[] A = new int[5];
		int c=0;
		
		for(int i=0;i<5;i++) {
			A[i]=sc.nextInt();
			if(A[i]%10!=0) {
				max=Math.max((10-A[i]%10), max);
				c=i;
				}	
		}
		
		for(int i=0;i<5;i++) {
			count+=A[i];
			for(int j=0;j<9;j++) {
				if(count%10!=0) {
					count++;
				}
			}
		}
		
		System.out.println(count-max);
		
		sc.close();
	}
}
