import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] a=new int[5];
		int an=0;
		int kk=9;
		for(int i = 0; i<5; i++){
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		}
		int ans=0;
		int count=0;
		for(int i = 0; i<5; i++){
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		}
		if(ans%10!=0){
				ans+=10-ans%10;
				ans+=an;
		}else{
				ans+=an;
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] a=new int[5];
		int an=0;
		int kk=9;
		for(int i = 0; i<5; i++){
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		}
		int ans=0;
		int count=0;
		for(int i = 0; i<5; i++){
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		}
		if(ans%10!=0){
				ans+=10-ans%10;
				ans+=an;
		}else{
				ans+=an;
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] a=new int[5];
		int an=0;
		int kk=9;
		for(int i = 0; i<5; i++){
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		}
		int ans=0;
		int count=0;
		for(int i = 0; i<5; i++){
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		}
		if(ans%10!=0){
				ans+=10-ans%10;
				ans+=an;
		}else{
				ans+=an;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int[] a=new int[5];
		int an=0;
		int kk=9;
		for(int i = 0; i<5; i++){
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		}
		int ans=0;
		int count=0;
		for(int i = 0; i<5; i++){
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		}
		if(ans%10!=0){
				ans+=10-ans%10;
				ans+=an;
		}else{
				ans+=an;
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] a=new int[5]; a new int[5] 5 int an=0; an 0 int kk=9; kk 9 for(int i = 0; i<5; i++){
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[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 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		} {
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		} a[i]=sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			} a[i]%10!=0 && a[i]%10<=kk a[i]%10!=0 a[i]%10 a[i] a i 10 0 a[i]%10<=kk a[i]%10 a[i] a i 10 kk {
				kk=a[i]%10;
				an=a[i];
			} kk=a[i]%10 kk a[i]%10 a[i] a i 10 an=a[i] an a[i] a i int ans=0; ans 0 int count=0; count 0 for(int i = 0; i<5; i++){
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		} int i = 0; int i = 0; i 0 i<5 i 5 i++ i++ i {
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		} {
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		} if(a[i]==an && count==0){
				count++;
				continue;
			} a[i]==an && count==0 a[i]==an a[i] a i an count==0 count 0 {
				count++;
				continue;
			} count++ count continue; if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			} ans%10!=0 ans%10 ans 10 0 {
				ans+=10-ans%10;
				ans+=a[i];
			} ans+=10-ans%10 ans 10-ans%10 10 ans%10 ans 10 ans+=a[i] ans a[i] a i {
				ans+=a[i];
			} ans+=a[i] ans a[i] a i if(ans%10!=0){
				ans+=10-ans%10;
				ans+=an;
		}else{
				ans+=an;
		} ans%10!=0 ans%10 ans 10 0 {
				ans+=10-ans%10;
				ans+=an;
		} ans+=10-ans%10 ans 10-ans%10 10 ans%10 ans 10 ans+=an ans an {
				ans+=an;
		} ans+=an ans an 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){
		Scanner sc = new Scanner(System.in);
		int[] a=new int[5];
		int an=0;
		int kk=9;
		for(int i = 0; i<5; i++){
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		}
		int ans=0;
		int count=0;
		for(int i = 0; i<5; i++){
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		}
		if(ans%10!=0){
				ans+=10-ans%10;
				ans+=an;
		}else{
				ans+=an;
		}
		System.out.println(ans);
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] a=new int[5];
		int an=0;
		int kk=9;
		for(int i = 0; i<5; i++){
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		}
		int ans=0;
		int count=0;
		for(int i = 0; i<5; i++){
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		}
		if(ans%10!=0){
				ans+=10-ans%10;
				ans+=an;
		}else{
				ans+=an;
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] a=new int[5];
		int an=0;
		int kk=9;
		for(int i = 0; i<5; i++){
			a[i]=sc.nextInt();
			if(a[i]%10!=0 && a[i]%10<=kk){
				kk=a[i]%10;
				an=a[i];
			}
		}
		int ans=0;
		int count=0;
		for(int i = 0; i<5; i++){
			if(a[i]==an && count==0){
				count++;
				continue;
			}
			if(ans%10!=0){
				ans+=10-ans%10;
				ans+=a[i];
			}else{
				ans+=a[i];
			}
		}
		if(ans%10!=0){
				ans+=10-ans%10;
				ans+=an;
		}else{
				ans+=an;
		}
		System.out.println(ans);
	}
}
