import java.io.*;

public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int[] arr = new int[5];
        int min=10; int idx = 0;
        for(int i=0;i<5;++i)
        {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        }
        int sum =0;
        for(int i=0;i<5;++i)
        {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        }
        sum+=arr[idx];
        bw.write(sum+"");
        bw.close();

    }
} import java.io.*; io.* java public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int[] arr = new int[5];
        int min=10; int idx = 0;
        for(int i=0;i<5;++i)
        {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        }
        int sum =0;
        for(int i=0;i<5;++i)
        {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        }
        sum+=arr[idx];
        bw.write(sum+"");
        bw.close();

    }
} Main public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int[] arr = new int[5];
        int min=10; int idx = 0;
        for(int i=0;i<5;++i)
        {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        }
        int sum =0;
        for(int i=0;i<5;++i)
        {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        }
        sum+=arr[idx];
        bw.write(sum+"");
        bw.close();

    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int[] arr = new int[5];
        int min=10; int idx = 0;
        for(int i=0;i<5;++i)
        {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        }
        int sum =0;
        for(int i=0;i<5;++i)
        {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        }
        sum+=arr[idx];
        bw.write(sum+"");
        bw.close();

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) int[] arr = new int[5]; arr new int[5] 5 int min=10; min 10 int idx = 0; idx 0 for(int i=0;i<5;++i)
        {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        } int i=0; int i=0; i 0 i<5 i 5 ++i ++i i {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        } {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        } arr[i] = Integer.parseInt(br.readLine()) arr[i] arr i Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;} ( arr[i]%10!=0) &&(arr[i]%10<min) ( arr[i]%10!=0) arr[i]%10 arr[i] arr i 10 0 (arr[i]%10<min) arr[i]%10 arr[i] arr i 10 min {idx=i; min=arr[i]%10;} idx=i idx i min=arr[i]%10 min arr[i]%10 arr[i] arr i 10 int sum =0; sum 0 for(int i=0;i<5;++i)
        {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        } int i=0; int i=0; i 0 i<5 i 5 ++i ++i i {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        } {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        } if(i==idx)continue; i==idx i idx continue; sum+=arr[i] sum arr[i] arr i while(sum%10!=0) sum++; sum%10!=0 sum%10 sum 10 0 sum++ sum sum+=arr[idx] sum arr[idx] arr idx bw.write(sum+"") bw.write bw sum+"" sum "" bw.close() bw.close bw String[] args args public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int[] arr = new int[5];
        int min=10; int idx = 0;
        for(int i=0;i<5;++i)
        {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        }
        int sum =0;
        for(int i=0;i<5;++i)
        {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        }
        sum+=arr[idx];
        bw.write(sum+"");
        bw.close();

    }
} public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int[] arr = new int[5];
        int min=10; int idx = 0;
        for(int i=0;i<5;++i)
        {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        }
        int sum =0;
        for(int i=0;i<5;++i)
        {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        }
        sum+=arr[idx];
        bw.write(sum+"");
        bw.close();

    }
} Main
import java.io.*;

public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int[] arr = new int[5];
        int min=10; int idx = 0;
        for(int i=0;i<5;++i)
        {
            arr[i] = Integer.parseInt(br.readLine());
            if( ( arr[i]%10!=0) &&(arr[i]%10<min)) {idx=i; min=arr[i]%10;}
        }
        int sum =0;
        for(int i=0;i<5;++i)
        {
            if(i==idx)continue;
            sum+=arr[i];
            while(sum%10!=0) sum++;
        }
        sum+=arr[idx];
        bw.write(sum+"");
        bw.close();

    }
}
