import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		List<Integer> abc = new ArrayList<Integer>();
		for(int i = 0;i < 5;i++) abc.add(sca.nextInt());
		int min = abc.get(0),index = 0,time = 0;
		for(int i = 0;i < 5;i++) {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		}
		for(int i = 0;i < 5;i++) {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		}
		time += abc.get(index);
		System.out.println(time);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		List<Integer> abc = new ArrayList<Integer>();
		for(int i = 0;i < 5;i++) abc.add(sca.nextInt());
		int min = abc.get(0),index = 0,time = 0;
		for(int i = 0;i < 5;i++) {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		}
		for(int i = 0;i < 5;i++) {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		}
		time += abc.get(index);
		System.out.println(time);
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		List<Integer> abc = new ArrayList<Integer>();
		for(int i = 0;i < 5;i++) abc.add(sca.nextInt());
		int min = abc.get(0),index = 0,time = 0;
		for(int i = 0;i < 5;i++) {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		}
		for(int i = 0;i < 5;i++) {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		}
		time += abc.get(index);
		System.out.println(time);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		List<Integer> abc = new ArrayList<Integer>();
		for(int i = 0;i < 5;i++) abc.add(sca.nextInt());
		int min = abc.get(0),index = 0,time = 0;
		for(int i = 0;i < 5;i++) {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		}
		for(int i = 0;i < 5;i++) {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		}
		time += abc.get(index);
		System.out.println(time);
	} Scanner sca = new Scanner(System.in); sca new Scanner(System.in) List<Integer> abc = new ArrayList<Integer>(); abc new ArrayList<Integer>() for(int i = 0;i < 5;i++) abc.add(sca.nextInt()); int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i abc.add(sca.nextInt()); abc.add(sca.nextInt()) abc.add abc sca.nextInt() sca.nextInt sca int min = abc.get(0) min abc.get(0) abc.get abc 0 index = 0 index 0 time = 0; time 0 for(int i = 0;i < 5;i++) {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		} {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		} if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			} min > abc.get(i) % 10 && abc.get(i)%10 != 0 min > abc.get(i) % 10 min abc.get(i) % 10 abc.get(i) abc.get abc i 10 abc.get(i)%10 != 0 abc.get(i)%10 abc.get(i) abc.get abc i 10 0 {
				min = abc.get(i) % 10;
				index = i;
			} min = abc.get(i) % 10 min abc.get(i) % 10 abc.get(i) abc.get abc i 10 index = i index i for(int i = 0;i < 5;i++) {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		} {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		} if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			} i != index i index {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			} if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i); abc.get(i)%10 != 0 abc.get(i)%10 abc.get(i) abc.get abc i 10 0 time += abc.get(i) + (10 - (abc.get(i)%10)) time abc.get(i) + (10 - (abc.get(i)%10)) abc.get(i) abc.get abc i (10 - (abc.get(i)%10)) 10 (abc.get(i)%10) abc.get(i) abc.get abc i 10 time += abc.get(i) time abc.get(i) abc.get abc i time += abc.get(index) time abc.get(index) abc.get abc index System.out.println(time) System.out.println System.out System System.out time String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		List<Integer> abc = new ArrayList<Integer>();
		for(int i = 0;i < 5;i++) abc.add(sca.nextInt());
		int min = abc.get(0),index = 0,time = 0;
		for(int i = 0;i < 5;i++) {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		}
		for(int i = 0;i < 5;i++) {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		}
		time += abc.get(index);
		System.out.println(time);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		List<Integer> abc = new ArrayList<Integer>();
		for(int i = 0;i < 5;i++) abc.add(sca.nextInt());
		int min = abc.get(0),index = 0,time = 0;
		for(int i = 0;i < 5;i++) {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		}
		for(int i = 0;i < 5;i++) {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		}
		time += abc.get(index);
		System.out.println(time);
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sca = new Scanner(System.in);
		List<Integer> abc = new ArrayList<Integer>();
		for(int i = 0;i < 5;i++) abc.add(sca.nextInt());
		int min = abc.get(0),index = 0,time = 0;
		for(int i = 0;i < 5;i++) {
			if(min > abc.get(i) % 10 && abc.get(i)%10 != 0) {
				min = abc.get(i) % 10;
				index = i;
			}
		}
		for(int i = 0;i < 5;i++) {
			if(i != index) {
				if(abc.get(i)%10 != 0) time += abc.get(i) + (10 - (abc.get(i)%10));
				else time += abc.get(i);
			}
		}
		time += abc.get(index);
		System.out.println(time);
	}
}