import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int[] menu = new int[5];
		int max=0;
		int mvalue=0;
		for(int i=0;i<5;i++) {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		}
		int count=0;
		for(int i=0;i<5;i++) {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		}
		count+=menu[max];
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int[] menu = new int[5];
		int max=0;
		int mvalue=0;
		for(int i=0;i<5;i++) {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		}
		int count=0;
		for(int i=0;i<5;i++) {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		}
		count+=menu[max];
		System.out.println(count);
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int[] menu = new int[5];
		int max=0;
		int mvalue=0;
		for(int i=0;i<5;i++) {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		}
		int count=0;
		for(int i=0;i<5;i++) {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		}
		count+=menu[max];
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int[] menu = new int[5];
		int max=0;
		int mvalue=0;
		for(int i=0;i<5;i++) {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		}
		int count=0;
		for(int i=0;i<5;i++) {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		}
		count+=menu[max];
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] menu = new int[5]; menu new int[5] 5 int max=0; max 0 int mvalue=0; mvalue 0 for(int i=0;i<5;i++) {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		} {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		} menu[i]=sc.nextInt() menu[i] menu i sc.nextInt() sc.nextInt sc int temp=10-menu[i]%10; temp 10-menu[i]%10 10 menu[i]%10 menu[i] menu i 10 if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			} temp>mvalue && temp!=10 temp>mvalue temp mvalue temp!=10 temp 10 {
				max=i;
				mvalue=temp;
			} max=i max i mvalue=temp mvalue temp int count=0; count 0 for(int i=0;i<5;i++) {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		} {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		} if(i==max) continue; i==max i max continue; int temp = 10-menu[i]%10; temp 10-menu[i]%10 10 menu[i]%10 menu[i] menu i 10 if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			} temp!=10 temp 10 {
			count+=menu[i]+10-menu[i]%10;
			} count+=menu[i]+10-menu[i]%10 count menu[i]+10-menu[i]%10 menu[i]+10 menu[i] menu i 10 menu[i]%10 menu[i] menu i 10 {
				count+=menu[i];
			} count+=menu[i] count menu[i] menu i count+=menu[max] count menu[max] menu max System.out.println(count) System.out.println System.out System System.out count String args[] args public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int[] menu = new int[5];
		int max=0;
		int mvalue=0;
		for(int i=0;i<5;i++) {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		}
		int count=0;
		for(int i=0;i<5;i++) {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		}
		count+=menu[max];
		System.out.println(count);
	}
} public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int[] menu = new int[5];
		int max=0;
		int mvalue=0;
		for(int i=0;i<5;i++) {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		}
		int count=0;
		for(int i=0;i<5;i++) {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		}
		count+=menu[max];
		System.out.println(count);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int[] menu = new int[5];
		int max=0;
		int mvalue=0;
		for(int i=0;i<5;i++) {
			menu[i]=sc.nextInt();
          int temp=10-menu[i]%10;
          
			if(temp>mvalue && temp!=10) {
				max=i;
				mvalue=temp;
			}
		}
		int count=0;
		for(int i=0;i<5;i++) {
			if(i==max) continue;
			int temp = 10-menu[i]%10;
			if(temp!=10) {
			count+=menu[i]+10-menu[i]%10;
			}else {
				count+=menu[i];
			}
		}
		count+=menu[max];
		System.out.println(count);
	}
}
