
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.riaml(5);
		int sub = 0;
		for(int n : arr) {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		}
		int sum = 0;
		for(int n : arr) {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		}
		sum -= sub;
		print(sum);
	}
	
	public static boolean emptyRow(String[] m, int row, int col) {
		for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false;
		return true;
	}
	
	public static boolean emptyCol(String[] m, int row, int col) {
		for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false;
		return true;
	}
	
	
	public static String repeat(String s, int n) {
		return String.join("", Collections.nCopies(n, s));
	}
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
} import java.util.*; util.* java import java.io.*; io.* java import java.lang.reflect.Array; Array java.lang.reflect public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.riaml(5);
		int sub = 0;
		for(int n : arr) {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		}
		int sum = 0;
		for(int n : arr) {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		}
		sum -= sub;
		print(sum);
	}
	
	public static boolean emptyRow(String[] m, int row, int col) {
		for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false;
		return true;
	}
	
	public static boolean emptyCol(String[] m, int row, int col) {
		for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false;
		return true;
	}
	
	
	public static String repeat(String s, int n) {
		return String.join("", Collections.nCopies(n, s));
	}
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
} Main public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.riaml(5);
		int sub = 0;
		for(int n : arr) {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		}
		int sum = 0;
		for(int n : arr) {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		}
		sum -= sub;
		print(sum);
	} main {
		FastReader r = new FastReader();
		int[] arr = r.riaml(5);
		int sub = 0;
		for(int n : arr) {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		}
		int sum = 0;
		for(int n : arr) {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		}
		sum -= sub;
		print(sum);
	} FastReader r = new FastReader(); r new FastReader() int[] arr = r.riaml(5); arr r.riaml(5) r.riaml r 5 int sub = 0; sub 0 for(int n : arr) {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		} int n arr {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		} {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		} if((n%10)!=0) sub = Math.max(sub, 10-(n%10)); (n%10)!=0 (n%10) n 10 0 sub = Math.max(sub, 10-(n%10)) sub Math.max(sub, 10-(n%10)) Math.max Math sub 10-(n%10) 10 (n%10) n 10 int sum = 0; sum 0 for(int n : arr) {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		} int n arr {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		} {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		} if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			} (n%10)==0 (n%10) n 10 0 sum+=n sum n {
				int temp = n/10;
				sum+= (temp+1)*10;
			} int temp = n/10; temp n/10 n 10 sum+= (temp+1)*10 sum (temp+1)*10 (temp+1) temp 1 10 sum -= sub sum sub print(sum) print sum String[] args args public static boolean emptyRow(String[] m, int row, int col) {
		for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false;
		return true;
	} emptyRow {
		for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false;
		return true;
	} for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false; int c = 0; int c = 0; c 0 c<m[0].length() c m[0].length() m[0].length m[0] m 0 c++ c++ c if(m[row].charAt(c) == '#')
				return false; if(m[row].charAt(c) == '#')
				return false; m[row].charAt(c) == '#' m[row].charAt(c) m[row].charAt m[row] m row c '#' return false; false return true; true String[] m m int row row int col col public static boolean emptyCol(String[] m, int row, int col) {
		for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false;
		return true;
	} emptyCol {
		for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false;
		return true;
	} for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false; int r = 0; int r = 0; r 0 r<m.length r m.length m m.length r++ r++ r if(m[r].charAt(col) == '#')
				return false; if(m[r].charAt(col) == '#')
				return false; m[r].charAt(col) == '#' m[r].charAt(col) m[r].charAt m[r] m r col '#' return false; false return true; true String[] m m int row row int col col public static String repeat(String s, int n) {
		return String.join("", Collections.nCopies(n, s));
	} repeat {
		return String.join("", Collections.nCopies(n, s));
	} return String.join("", Collections.nCopies(n, s)); String.join("", Collections.nCopies(n, s)) String.join String "" Collections.nCopies(n, s) Collections.nCopies Collections n s String s s int n n public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	} getDigitSum {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	} String str = ""+n; str ""+n "" n int sum = 0; sum 0 for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		} int i = 0; int i = 0; i 0 i<str.length() i str.length() str.length str i++ i++ i {
			sum += Integer.parseInt(""+str.charAt(i));
		} {
			sum += Integer.parseInt(""+str.charAt(i));
		} sum += Integer.parseInt(""+str.charAt(i)) sum Integer.parseInt(""+str.charAt(i)) Integer.parseInt Integer ""+str.charAt(i) "" str.charAt(i) str.charAt str i return sum; sum int n n public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	} rolling {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	} if (arr.length < 2)
			return; arr.length < 2 arr.length arr arr.length 2 return; for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1]; int i = 1; int i = 1; i 1 i < arr.length i arr.length arr arr.length i++ i++ i arr[i] += arr[i - 1]; arr[i] += arr[i - 1] arr[i] arr i arr[i - 1] arr i - 1 i 1 int[] arr arr public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	} rolling {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	} if (arr.length < 2)
			return; arr.length < 2 arr.length arr arr.length 2 return; for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1]; int i = 1; int i = 1; i 1 i < arr.length i arr.length arr arr.length i++ i++ i arr[i] += arr[i - 1]; arr[i] += arr[i - 1] arr[i] arr i arr[i - 1] arr i - 1 i 1 long[] arr arr public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	} reverse {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	} for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		} int i = 0; int i = 0; i 0 i < arr.length / 2 i arr.length / 2 arr.length arr arr.length 2 i++ i++ i {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		} {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		} int temp = arr[i]; temp arr[i] arr i arr[i] = arr[arr.length - 1 - i] arr[i] arr i arr[arr.length - 1 - i] arr arr.length - 1 - i arr.length - 1 - i arr.length arr arr.length 1 i arr[arr.length - 1 - i] = temp arr[arr.length - 1 - i] arr arr.length - 1 - i arr.length - 1 - i arr.length arr arr.length 1 i temp int[] arr arr public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	} swap {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	} int temp = arr[pos1]; temp arr[pos1] arr pos1 arr[pos1] = arr[pos2] arr[pos1] arr pos1 arr[pos2] arr pos2 arr[pos2] = temp arr[pos2] arr pos2 temp int[] arr arr int pos1 pos1 int pos2 pos2 public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	} swap {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	} long temp = arr[pos1]; temp arr[pos1] arr pos1 arr[pos1] = arr[pos2] arr[pos1] arr pos1 arr[pos2] arr pos2 arr[pos2] = temp arr[pos2] arr pos2 temp long[] arr arr int pos1 pos1 int pos2 pos2 public static String al(String s) {
		return s + "\n";
	} al {
		return s + "\n";
	} return s + "\n"; s + "\n" s "\n" String s s public static void print(String s) {
		System.out.println(s);
	} print {
		System.out.println(s);
	} System.out.println(s) System.out.println System.out System System.out s String s s public static void print(long s) {
		System.out.println(s);
	} print {
		System.out.println(s);
	} System.out.println(s) System.out.println System.out System System.out s long s s public static void print(int s) {
		System.out.println(s);
	} print {
		System.out.println(s);
	} System.out.println(s) System.out.println System.out System System.out s int s s static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	} FastReader BufferedReader br; br StringTokenizer st; st public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		} FastReader {
			br = new BufferedReader(new InputStreamReader(System.in));
		} br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) int ri() {
			return Integer.parseInt(str());
		} ri {
			return Integer.parseInt(str());
		} return Integer.parseInt(str()); Integer.parseInt(str()) Integer.parseInt Integer str() str long rl() {
			return Long.parseLong(str());
		} rl {
			return Long.parseLong(str());
		} return Long.parseLong(str()); Long.parseLong(str()) Long.parseLong Long str() str double rd() {
			return Double.parseDouble(str());
		} rd {
			return Double.parseDouble(str());
		} return Double.parseDouble(str()); Double.parseDouble(str()) Double.parseDouble Double str() str String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		} str {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		} String str = ""; str "" try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			} IOException e {
				e.printStackTrace();
			} e.printStackTrace() e.printStackTrace e {
				str = br.readLine();
			} str = br.readLine() str br.readLine() br.readLine br return str; str String[] rsa() {
			return str().split(" ");
		} rsa {
			return str().split(" ");
		} return str().split(" "); str().split(" ") str().split str() str " " int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		} ria {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		} String[] s = rsa(); s rsa() rsa int[] arr = new int[s.length]; arr new int[s.length] s.length s s.length for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]); int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i arr[i] = Integer.parseInt(s[i]); arr[i] = Integer.parseInt(s[i]) arr[i] arr i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i return arr; arr long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		} rla {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		} String[] s = rsa(); s rsa() rsa long[] arr = new long[s.length]; arr new long[s.length] s.length s s.length for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]); int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i arr[i] = Long.parseLong(s[i]); arr[i] = Long.parseLong(s[i]) arr[i] arr i Long.parseLong(s[i]) Long.parseLong Long s[i] s i return arr; arr char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		} rca {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		} String s = str(); s str() str char[] arr = new char[s.length()]; arr new char[s.length()] s.length() s.length s for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i); int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i arr[i] = s.charAt(i); arr[i] = s.charAt(i) arr[i] arr i s.charAt(i) s.charAt s i return arr; arr String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		} rsaml {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		} String[] arr = new String[m]; arr new String[m] m for (int i = 0; i < arr.length; i++)
				arr[i] = str(); int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i arr[i] = str(); arr[i] = str() arr[i] arr i str() str return arr; arr int m m int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		} riaml {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		} int[] arr = new int[m]; arr new int[m] m for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str()); int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i arr[i] = Integer.parseInt(str()); arr[i] = Integer.parseInt(str()) arr[i] arr i Integer.parseInt(str()) Integer.parseInt Integer str() str return arr; arr int m m long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		} rlaml {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		} long[] arr = new long[m]; arr new long[m] m for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str()); int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i arr[i] = Long.parseLong(str()); arr[i] = Long.parseLong(str()) arr[i] arr i Long.parseLong(str()) Long.parseLong Long str() str return arr; arr int m m class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
} Node public int val; val public boolean visited; visited public Node(int v) { val=v; } Node { val=v; } val=v val v int v v public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.riaml(5);
		int sub = 0;
		for(int n : arr) {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		}
		int sum = 0;
		for(int n : arr) {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		}
		sum -= sub;
		print(sum);
	}
	
	public static boolean emptyRow(String[] m, int row, int col) {
		for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false;
		return true;
	}
	
	public static boolean emptyCol(String[] m, int row, int col) {
		for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false;
		return true;
	}
	
	
	public static String repeat(String s, int n) {
		return String.join("", Collections.nCopies(n, s));
	}
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
} public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.riaml(5);
		int sub = 0;
		for(int n : arr) {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		}
		int sum = 0;
		for(int n : arr) {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		}
		sum -= sub;
		print(sum);
	}
	
	public static boolean emptyRow(String[] m, int row, int col) {
		for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false;
		return true;
	}
	
	public static boolean emptyCol(String[] m, int row, int col) {
		for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false;
		return true;
	}
	
	
	public static String repeat(String s, int n) {
		return String.join("", Collections.nCopies(n, s));
	}
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
} Main

import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.riaml(5);
		int sub = 0;
		for(int n : arr) {
			if((n%10)!=0) sub = Math.max(sub, 10-(n%10));
		}
		int sum = 0;
		for(int n : arr) {
			if((n%10)==0) sum+=n;
			else {
				int temp = n/10;
				sum+= (temp+1)*10;
			}
		}
		sum -= sub;
		print(sum);
	}
	
	public static boolean emptyRow(String[] m, int row, int col) {
		for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false;
		return true;
	}
	
	public static boolean emptyCol(String[] m, int row, int col) {
		for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false;
		return true;
	}
	
	
	public static String repeat(String s, int n) {
		return String.join("", Collections.nCopies(n, s));
	}
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
}
