import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
    	int[] time = new int[5];
    	int[] sabun = new int[5];
    	int[] jun = new int[5];
    	int result=0;
        try {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
    	int[] time = new int[5];
    	int[] sabun = new int[5];
    	int[] jun = new int[5];
    	int result=0;
        try {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
} Main private static Scanner sc; sc public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    } main {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    } Main instance = new Main(); instance new Main() sc = instance.new Scanner() sc instance.new Scanner() instance instance instance.solve() instance.solve instance String[] args args private void solve() {
    	int[] time = new int[5];
    	int[] sabun = new int[5];
    	int[] jun = new int[5];
    	int result=0;
        try {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } solve {
    	int[] time = new int[5];
    	int[] sabun = new int[5];
    	int[] jun = new int[5];
    	int result=0;
        try {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } int[] time = new int[5]; time new int[5] 5 int[] sabun = new int[5]; sabun new int[5] 5 int[] jun = new int[5]; jun new int[5] 5 int result=0; result 0 try {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } Exception e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	} int i = 0; int i = 0; i 0 i<5 i 5 i++ i++ i {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	} {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	} time[i] = sc.nextInt() time[i] time i sc.nextInt() sc.nextInt sc sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10 sabun[i] sabun i 10-time[i]%10==10? 0:10-time[i]%10 10-time[i]%10==10 10-time[i]%10 10 time[i]%10 time[i] time i 10 10 0 10-time[i]%10 10 time[i]%10 time[i] time i 10 int idx=0; idx 0 for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	} int check=0; int check=0; check 0 check<10 check 10 check++ check++ check {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	} {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	} for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		} {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		} if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			} sabun[i]==check sabun[i] sabun i check {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			} jun[idx]=i jun[idx] jun idx i idx++ idx int cnt=0; cnt 0 for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	} int i jun {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	} {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	} if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i]; cnt != 4 cnt 4 result += time[i]+sabun[i] result time[i]+sabun[i] time[i] time i sabun[i] sabun i result += time[i] result time[i] time i cnt++ cnt System.out.println(result) System.out.println System.out System System.out result private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    } Scanner String[] s; s int i; i BufferedReader br; br String regex = " "; regex " " public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        } Scanner {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        } s = new String[0] s new String[0] 0 i = 0 i 0 br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        } finalize {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        } try {
                super.finalize();
            } finally {
                destruction();
            } {
                destruction();
            } destruction() destruction {
                super.finalize();
            } super.finalize() super.finalize super private void destruction() throws IOException {
            if (br != null) br.close();
        } destruction {
            if (br != null) br.close();
        } if (br != null) br.close(); br != null br null br.close() br.close br public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        } next {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        } if (i < s.length) return s[i++]; i < s.length i s.length s s.length return s[i++]; s[i++] s i++ i String st = br.readLine(); st br.readLine() br.readLine br while (st == "") st = br.readLine(); st == "" st "" st = br.readLine() st br.readLine() br.readLine br s = st.split(regex, 0) s st.split(regex, 0) st.split st regex 0 i = 0 i 0 return s[i++]; s[i++] s i++ i public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        } nextDouble {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
    	int[] time = new int[5];
    	int[] sabun = new int[5];
    	int[] jun = new int[5];
    	int result=0;
        try {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
} public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
    	int[] time = new int[5];
    	int[] sabun = new int[5];
    	int[] jun = new int[5];
    	int result=0;
        try {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
    	int[] time = new int[5];
    	int[] sabun = new int[5];
    	int[] jun = new int[5];
    	int result=0;
        try {
        	for (int i = 0; i<5;i++ ) {
        		time[i] = sc.nextInt();
        		sabun[i] = 10-time[i]%10==10? 0:10-time[i]%10;
        	}
        	int idx=0;
        	for(int check=0;check<10;check++) {
        		//System.out.println("check:"+check);
        		for (int i=0;i<5;i++) {
        			if (sabun[i]==check) {
        				//System.out.println("sabun["+i+"] : "+sabun[i]);
        				jun[idx]=i;
        				idx++;
        			}
        		}
        	}

        	int cnt=0;
        	for (int i : jun) {
        		//System.out.println("result : "+ result);
        		if (cnt != 4) result += time[i]+sabun[i];
        		else result += time[i];
        		cnt++;
        	}
        	/*
        	for(int i=0;i<5;i++) {
        		System.out.println(time[i]+" ,"+sabun[i]+" ,"+jun[i]);
        	}*/
        	System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}