import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int a[]=new int[5];
		a[0]=scan.nextInt();
		a[1]=scan.nextInt();
		a[2]=scan.nextInt();
		a[3]=scan.nextInt();
		a[4]=scan.nextInt();
		int ans=0;
		for(int i=0;i<5;i++) {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int a[]=new int[5];
		a[0]=scan.nextInt();
		a[1]=scan.nextInt();
		a[2]=scan.nextInt();
		a[3]=scan.nextInt();
		a[4]=scan.nextInt();
		int ans=0;
		for(int i=0;i<5;i++) {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int a[]=new int[5];
		a[0]=scan.nextInt();
		a[1]=scan.nextInt();
		a[2]=scan.nextInt();
		a[3]=scan.nextInt();
		a[4]=scan.nextInt();
		int ans=0;
		for(int i=0;i<5;i++) {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		}
		System.out.println(ans);
	} main {
		Scanner scan=new Scanner(System.in);
		int a[]=new int[5];
		a[0]=scan.nextInt();
		a[1]=scan.nextInt();
		a[2]=scan.nextInt();
		a[3]=scan.nextInt();
		a[4]=scan.nextInt();
		int ans=0;
		for(int i=0;i<5;i++) {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		}
		System.out.println(ans);
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int a[]=new int[5]; a new int[5] 5 a[0]=scan.nextInt() a[0] a 0 scan.nextInt() scan.nextInt scan a[1]=scan.nextInt() a[1] a 1 scan.nextInt() scan.nextInt scan a[2]=scan.nextInt() a[2] a 2 scan.nextInt() scan.nextInt scan a[3]=scan.nextInt() a[3] a 3 scan.nextInt() scan.nextInt scan a[4]=scan.nextInt() a[4] a 4 scan.nextInt() scan.nextInt scan int ans=0; ans 0 for(int i=0;i<5;i++) {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		} {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		} int k=0; k 0 int sa=1000000000; sa 1000000000 for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			} int j=0; int j=0; j 0 j<5 j 5 j++ j++ j {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			} {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			} if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				} a[j]!=0 a[j] a j 0 {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				} int l=10-a[j]%10; l 10-a[j]%10 10 a[j]%10 a[j] a j 10 if(sa>l) {
						sa=l;
						k=j;
					} sa>l sa l {
						sa=l;
						k=j;
					} sa=l sa l k=j k j if(a[j]%10==0) {
						k=j;
						break;
					} a[j]%10==0 a[j]%10 a[j] a j 10 0 {
						k=j;
						break;
					} k=j k j break; if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			} a[k]%10==0 a[k]%10 a[k] a k 10 0 {
			ans+=a[k];
			} ans+=a[k] ans a[k] a k {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			} if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				} i!=4 i 4 {
			ans+=(a[k]/10+1)*10;
				} ans+=(a[k]/10+1)*10 ans (a[k]/10+1)*10 (a[k]/10+1) a[k]/10 a[k] a k 10 1 10 {
					ans+=a[k];
				} ans+=a[k] ans a[k] a k a[k]=0 a[k] a k 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int a[]=new int[5];
		a[0]=scan.nextInt();
		a[1]=scan.nextInt();
		a[2]=scan.nextInt();
		a[3]=scan.nextInt();
		a[4]=scan.nextInt();
		int ans=0;
		for(int i=0;i<5;i++) {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int a[]=new int[5];
		a[0]=scan.nextInt();
		a[1]=scan.nextInt();
		a[2]=scan.nextInt();
		a[3]=scan.nextInt();
		a[4]=scan.nextInt();
		int ans=0;
		for(int i=0;i<5;i++) {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan=new Scanner(System.in);
		int a[]=new int[5];
		a[0]=scan.nextInt();
		a[1]=scan.nextInt();
		a[2]=scan.nextInt();
		a[3]=scan.nextInt();
		a[4]=scan.nextInt();
		int ans=0;
		for(int i=0;i<5;i++) {
			int k=0;
			int sa=1000000000;
			for(int j=0;j<5;j++) {
				if(a[j]!=0) {
					int l=10-a[j]%10;
					if(sa>l) {
						sa=l;
						k=j;
					}
					if(a[j]%10==0) {
						k=j;
						break;
					}
				}
			}
			if(a[k]%10==0) {
			ans+=a[k];
			}
			else {
				if(i!=4) {
			ans+=(a[k]/10+1)*10;
				}
				else {
					ans+=a[k];
				}
			}
			a[k]=0;
		}
		System.out.println(ans);
	}
}