import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 5;
	 int[] menu = new int[n];
	 int[] nextTime  = new int[n];
	for(int i = 0; i < n; i++) {
		menu[i] = sc.nextInt();
	}
	for(int i = 0; i < n; i++) {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	}
	int bestTime = Integer.MAX_VALUE;
	for(int i = 0; i < n; i++) {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	}
	System.out.println(bestTime);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 5;
	 int[] menu = new int[n];
	 int[] nextTime  = new int[n];
	for(int i = 0; i < n; i++) {
		menu[i] = sc.nextInt();
	}
	for(int i = 0; i < n; i++) {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	}
	int bestTime = Integer.MAX_VALUE;
	for(int i = 0; i < n; i++) {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	}
	System.out.println(bestTime);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 5;
	 int[] menu = new int[n];
	 int[] nextTime  = new int[n];
	for(int i = 0; i < n; i++) {
		menu[i] = sc.nextInt();
	}
	for(int i = 0; i < n; i++) {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	}
	int bestTime = Integer.MAX_VALUE;
	for(int i = 0; i < n; i++) {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	}
	System.out.println(bestTime);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = 5;
	 int[] menu = new int[n];
	 int[] nextTime  = new int[n];
	for(int i = 0; i < n; i++) {
		menu[i] = sc.nextInt();
	}
	for(int i = 0; i < n; i++) {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	}
	int bestTime = Integer.MAX_VALUE;
	for(int i = 0; i < n; i++) {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	}
	System.out.println(bestTime);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = 5; n 5 int[] menu = new int[n]; menu new int[n] n int[] nextTime  = new int[n]; nextTime new int[n] n for(int i = 0; i < n; i++) {
		menu[i] = sc.nextInt();
	} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		menu[i] = sc.nextInt();
	} {
		menu[i] = sc.nextInt();
	} menu[i] = sc.nextInt() menu[i] menu i sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++) {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	} {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	} if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		} menu[i]%10==0 menu[i]%10 menu[i] menu i 10 0 {
			nextTime[i] = menu[i];
		} nextTime[i] = menu[i] nextTime[i] nextTime i menu[i] menu i {
		nextTime[i] = menu[i] - menu[i]%10+10;
		} nextTime[i] = menu[i] - menu[i]%10+10 nextTime[i] nextTime i menu[i] - menu[i]%10+10 menu[i] - menu[i]%10 menu[i] menu i menu[i]%10 menu[i] menu i 10 10 int bestTime = Integer.MAX_VALUE; bestTime Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i < n; i++) {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	} {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	} int nowTime = 0; nowTime 0 for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		} {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		} if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			} i == j i j {
				nowTime+=menu[j];
			} nowTime+=menu[j] nowTime menu[j] menu j {
				nowTime+=nextTime[j];
			} nowTime+=nextTime[j] nowTime nextTime[j] nextTime j bestTime = Math.min(nowTime, bestTime) bestTime Math.min(nowTime, bestTime) Math.min Math nowTime bestTime System.out.println(bestTime) System.out.println System.out System System.out bestTime String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 5;
	 int[] menu = new int[n];
	 int[] nextTime  = new int[n];
	for(int i = 0; i < n; i++) {
		menu[i] = sc.nextInt();
	}
	for(int i = 0; i < n; i++) {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	}
	int bestTime = Integer.MAX_VALUE;
	for(int i = 0; i < n; i++) {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	}
	System.out.println(bestTime);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 5;
	 int[] menu = new int[n];
	 int[] nextTime  = new int[n];
	for(int i = 0; i < n; i++) {
		menu[i] = sc.nextInt();
	}
	for(int i = 0; i < n; i++) {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	}
	int bestTime = Integer.MAX_VALUE;
	for(int i = 0; i < n; i++) {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	}
	System.out.println(bestTime);
	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 5;
	 int[] menu = new int[n];
	 int[] nextTime  = new int[n];
	for(int i = 0; i < n; i++) {
		menu[i] = sc.nextInt();
	}
	for(int i = 0; i < n; i++) {
		if(menu[i]%10==0) {
			nextTime[i] = menu[i];
		}
		else {
		nextTime[i] = menu[i] - menu[i]%10+10;
		}
	}
	int bestTime = Integer.MAX_VALUE;
	for(int i = 0; i < n; i++) {
		int nowTime = 0;
		for(int j = 0; j < n; j++) {
			if(i == j) {
				nowTime+=menu[j];
			}
			else {
				nowTime+=nextTime[j];
			}
		}
		bestTime = Math.min(nowTime, bestTime);
	}
	System.out.println(bestTime);
	}

}
