import java.util.*;

public class Main{
    boolean[] used;
    int[] perm, time;
    int out;
    void solve(){
        Scanner scan = new Scanner(System.in);
        time = new int[5];
        for(int i = 0; i < 5; i++) time[i] = scan.nextInt();
        perm = new int[5];
        used = new boolean[5];
        out = Integer.MAX_VALUE;
        permutation(0);
        System.out.println(out);
        scan.close();
    }

    void permutation(int i){
        if(i == 5){
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        }
        for(int j = 0; j < 5; j++){
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
} import java.util.*; util.* java public class Main{
    boolean[] used;
    int[] perm, time;
    int out;
    void solve(){
        Scanner scan = new Scanner(System.in);
        time = new int[5];
        for(int i = 0; i < 5; i++) time[i] = scan.nextInt();
        perm = new int[5];
        used = new boolean[5];
        out = Integer.MAX_VALUE;
        permutation(0);
        System.out.println(out);
        scan.close();
    }

    void permutation(int i){
        if(i == 5){
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        }
        for(int j = 0; j < 5; j++){
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
} Main boolean[] used; used int[] perm perm time; time int out; out void solve(){
        Scanner scan = new Scanner(System.in);
        time = new int[5];
        for(int i = 0; i < 5; i++) time[i] = scan.nextInt();
        perm = new int[5];
        used = new boolean[5];
        out = Integer.MAX_VALUE;
        permutation(0);
        System.out.println(out);
        scan.close();
    } solve {
        Scanner scan = new Scanner(System.in);
        time = new int[5];
        for(int i = 0; i < 5; i++) time[i] = scan.nextInt();
        perm = new int[5];
        used = new boolean[5];
        out = Integer.MAX_VALUE;
        permutation(0);
        System.out.println(out);
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) time = new int[5] time new int[5] 5 for(int i = 0; i < 5; i++) time[i] = scan.nextInt(); int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i time[i] = scan.nextInt(); time[i] = scan.nextInt() time[i] time i scan.nextInt() scan.nextInt scan perm = new int[5] perm new int[5] 5 used = new boolean[5] used new boolean[5] 5 out = Integer.MAX_VALUE out Integer.MAX_VALUE Integer Integer.MAX_VALUE permutation(0) permutation 0 System.out.println(out) System.out.println System.out System System.out out scan.close() scan.close scan void permutation(int i){
        if(i == 5){
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        }
        for(int j = 0; j < 5; j++){
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        }
    } permutation {
        if(i == 5){
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        }
        for(int j = 0; j < 5; j++){
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        }
    } if(i == 5){
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        } i == 5 i 5 {
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        } int t = 0; t 0 for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            } int j = 0; int j = 0; j 0 j < 5 j 5 j++ j++ j {
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            } {
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            } t += time[perm[j]] t time[perm[j]] time perm[j] perm j if(j == 4) continue; j == 4 j 4 continue; t = t % 10 == 0 ? t : 10 * (t / 10 + 1) t t % 10 == 0 ? t : 10 * (t / 10 + 1) t % 10 == 0 t % 10 t 10 0 t 10 * (t / 10 + 1) 10 (t / 10 + 1) t / 10 t 10 1 out = Math.min(out, t) out Math.min(out, t) Math.min Math out t return; for(int j = 0; j < 5; j++){
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        } int j = 0; int j = 0; j 0 j < 5 j 5 j++ j++ j {
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        } {
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        } if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            } !used[j] used[j] used j {
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            } perm[i] = j perm[i] perm i j used[j] = true used[j] used j true permutation(i + 1) permutation i + 1 i 1 used[j] = false used[j] used j false int i i public static void main(String[] args){
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main{
    boolean[] used;
    int[] perm, time;
    int out;
    void solve(){
        Scanner scan = new Scanner(System.in);
        time = new int[5];
        for(int i = 0; i < 5; i++) time[i] = scan.nextInt();
        perm = new int[5];
        used = new boolean[5];
        out = Integer.MAX_VALUE;
        permutation(0);
        System.out.println(out);
        scan.close();
    }

    void permutation(int i){
        if(i == 5){
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        }
        for(int j = 0; j < 5; j++){
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
} public class Main{
    boolean[] used;
    int[] perm, time;
    int out;
    void solve(){
        Scanner scan = new Scanner(System.in);
        time = new int[5];
        for(int i = 0; i < 5; i++) time[i] = scan.nextInt();
        perm = new int[5];
        used = new boolean[5];
        out = Integer.MAX_VALUE;
        permutation(0);
        System.out.println(out);
        scan.close();
    }

    void permutation(int i){
        if(i == 5){
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        }
        for(int j = 0; j < 5; j++){
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
} Main
import java.util.*;

public class Main{
    boolean[] used;
    int[] perm, time;
    int out;
    void solve(){
        Scanner scan = new Scanner(System.in);
        time = new int[5];
        for(int i = 0; i < 5; i++) time[i] = scan.nextInt();
        perm = new int[5];
        used = new boolean[5];
        out = Integer.MAX_VALUE;
        permutation(0);
        System.out.println(out);
        scan.close();
    }

    void permutation(int i){
        if(i == 5){
            int t = 0;
            for(int j = 0; j < 5; j++){
                t += time[perm[j]];
                if(j == 4) continue;
                t = t % 10 == 0 ? t : 10 * (t / 10 + 1);
            }
            out = Math.min(out, t);
            return;
        }
        for(int j = 0; j < 5; j++){
            if(!used[j]){
                perm[i] = j;
                used[j] = true;
                permutation(i + 1);
                used[j] = false;
            }
        }
    }

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