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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();

        int d[]=sc.nextIntArray(5);
        int s=0;
        for (int i = 0; i < d.length; i++) {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		}
        sort(d);
        db(d);
        for (int i = 0; i < d.length-1; i++) {
			s+=d[i];
		}
        
       
        out.println(s);
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int id,T;
//    P(int id, int T) {
//        this.id=id;
//        this.T=T;
//    }
//    public int compareTo(P p){
//        return id-p.id; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
} import java.util.*; util.* java import java.io.*; io.* java import java.lang.reflect.Array; Array java.lang.reflect import java.math.BigInteger; BigInteger java.math import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Arrays.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.util.Collections.*; import static java.util.Collections.*; public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();

        int d[]=sc.nextIntArray(5);
        int s=0;
        for (int i = 0; i < d.length; i++) {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		}
        sort(d);
        db(d);
        for (int i = 0; i < d.length-1; i++) {
			s+=d[i];
		}
        
       
        out.println(s);
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
} Main static final long mod=1000000007; mod 1000000007 public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();

        int d[]=sc.nextIntArray(5);
        int s=0;
        for (int i = 0; i < d.length; i++) {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		}
        sort(d);
        db(d);
        for (int i = 0; i < d.length-1; i++) {
			s+=d[i];
		}
        
       
        out.println(s);
        out.flush();
    } main {        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();

        int d[]=sc.nextIntArray(5);
        int s=0;
        for (int i = 0; i < d.length; i++) {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		}
        sort(d);
        db(d);
        for (int i = 0; i < d.length-1; i++) {
			s+=d[i];
		}
        
       
        out.println(s);
        out.flush();
    } Reader sc = new Reader(System.in); sc new Reader(System.in) PrintWriter out=new PrintWriter(System.out); out new PrintWriter(System.out) int d[]=sc.nextIntArray(5); d sc.nextIntArray(5) sc.nextIntArray sc 5 int s=0; s 0 for (int i = 0; i < d.length; i++) {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		} int i = 0; int i = 0; i 0 i < d.length i d.length d d.length i++ i++ i {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		} {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		} s+=d[i] s d[i] d i if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0; d[i]%10!=0 d[i]%10 d[i] d i 10 0 d[i]=10-d[i]%10 d[i] d i 10-d[i]%10 10 d[i]%10 d[i] d i 10 d[i]=0 d[i] d i 0 sort(d) sort d db(d) db d for (int i = 0; i < d.length-1; i++) {
			s+=d[i];
		} int i = 0; int i = 0; i 0 i < d.length-1 i d.length-1 d.length d d.length 1 i++ i++ i {
			s+=d[i];
		} {
			s+=d[i];
		} s+=d[i] s d[i] d i out.println(s) out.println out s out.flush() out.flush out String[] args args static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    } validpos {
        return x<r && 0<=x && y<c && 0<=y;
    } return x<r && 0<=x && y<c && 0<=y; x<r && 0<=x && y<c && 0<=y y<c x<r && 0<=x && y<c && 0<=y x<r x r 0<=x 0 x y<c y c 0<=y 0 y int x x int y y int r r int c c static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    } db {
        System.err.println(Arrays.deepToString(os));
    } System.err.println(Arrays.deepToString(os)) System.err.println System.err System System.err Arrays.deepToString(os) Arrays.deepToString Arrays os Object... os os class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
} Reader private BufferedReader x; x private StringTokenizer st; st public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    } Reader {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    } x = new BufferedReader(new InputStreamReader(in)) x new BufferedReader(new InputStreamReader(in)) st = null st null InputStream in in public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    } nextString {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    } while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine()); st==null || !st.hasMoreTokens() st==null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(x.readLine()) st new StringTokenizer(x.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    } nextInt {
        return Integer.parseInt(nextString());
    } return Integer.parseInt(nextString()); Integer.parseInt(nextString()) Integer.parseInt Integer nextString() nextString public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    } nextIntArray {
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    } int r[] = new int[size]; r new int[size] size for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		} int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
			r[i] = this.nextInt(); 
		} {
			r[i] = this.nextInt(); 
		} r[i] = this.nextInt() r[i] r i this.nextInt() this.nextInt this return r; r int size size public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    } nextLongArray {
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    } long r[] = new long[size]; r new long[size] size for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		} int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
			r[i] = this.nextLong(); 
		} {
			r[i] = this.nextLong(); 
		} r[i] = this.nextLong() r[i] r i this.nextLong() this.nextLong this return r; r int size size public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    } nextLong {
        return Long.parseLong(nextString());
    } return Long.parseLong(nextString()); Long.parseLong(nextString()) Long.parseLong Long nextString() nextString public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    } nextDouble {
        return Double.parseDouble(nextString());
    } return Double.parseDouble(nextString()); Double.parseDouble(nextString()) Double.parseDouble Double nextString() nextString public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();

        int d[]=sc.nextIntArray(5);
        int s=0;
        for (int i = 0; i < d.length; i++) {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		}
        sort(d);
        db(d);
        for (int i = 0; i < d.length-1; i++) {
			s+=d[i];
		}
        
       
        out.println(s);
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
} public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();

        int d[]=sc.nextIntArray(5);
        int s=0;
        for (int i = 0; i < d.length; i++) {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		}
        sort(d);
        db(d);
        for (int i = 0; i < d.length-1; i++) {
			s+=d[i];
		}
        
       
        out.println(s);
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
} Main
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n = sc.nextInt();

        int d[]=sc.nextIntArray(5);
        int s=0;
        for (int i = 0; i < d.length; i++) {
			s+=d[i];
			if(d[i]%10!=0)d[i]=10-d[i]%10;
			else d[i]=0;
		}
        sort(d);
        db(d);
        for (int i = 0; i < d.length-1; i++) {
			s+=d[i];
		}
        
       
        out.println(s);
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int id,T;
//    P(int id, int T) {
//        this.id=id;
//        this.T=T;
//    }
//    public int compareTo(P p){
//        return id-p.id; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}
