
import java.io.*;
import java.text.*;
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int array[]= new int[5];
		int pos = 0;
		int low = 9;
		for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		}
		sum += array[pos];
		System.out.println(sum);
	}
} import java.io.*; io.* java import java.text.*; text.* java import java.util.*; util.* java public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int array[]= new int[5];
		int pos = 0;
		int low = 9;
		for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		}
		sum += array[pos];
		System.out.println(sum);
	}
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		int array[]= new int[5];
		int pos = 0;
		int low = 9;
		for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		}
		sum += array[pos];
		System.out.println(sum);
	} main {
		int array[]= new int[5];
		int pos = 0;
		int low = 9;
		for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		}
		sum += array[pos];
		System.out.println(sum);
	} int array[]= new int[5]; array new int[5] 5 int pos = 0; pos 0 int low = 9; low 9 for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		} {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc int target = array[i] % 10; target array[i] % 10 array[i] array i 10 if (target!= 0 && low > target) {
				low = target;
				pos = i;
			} target!= 0 && low > target target!= 0 target 0 low > target low target {
				low = target;
				pos = i;
			} low = target low target pos = i pos i int sum = 0; sum 0 for (int i = 0; i < 5; i++) {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		} {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		} if (i != pos) {
				sum += array[i];
			} i != pos i pos {
				sum += array[i];
			} sum += array[i] sum array[i] array i if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			} (sum % 10) != 0 (sum % 10) sum 10 0 {
				sum = (10 - (sum % 10)) + sum ;
			} sum = (10 - (sum % 10)) + sum sum (10 - (sum % 10)) + sum (10 - (sum % 10)) 10 (sum % 10) sum 10 sum sum += array[pos] sum array[pos] array pos System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int array[]= new int[5];
		int pos = 0;
		int low = 9;
		for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		}
		sum += array[pos];
		System.out.println(sum);
	}
} public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int array[]= new int[5];
		int pos = 0;
		int low = 9;
		for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		}
		sum += array[pos];
		System.out.println(sum);
	}
} Main

import java.io.*;
import java.text.*;
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int array[]= new int[5];
		int pos = 0;
		int low = 9;
		for (int i = 0; i < 5; i++) {
			array[i] = sc.nextInt();
			int target = array[i] % 10;
			if (target!= 0 && low > target) {
				low = target;
				pos = i;
			}
		}
		
		int sum = 0;
		for (int i = 0; i < 5; i++) {
			if (i != pos) {
				sum += array[i];
			}
			if ((sum % 10) != 0) {
				sum = (10 - (sum % 10)) + sum ;
			}
		}
		sum += array[pos];
		System.out.println(sum);
	}
}