import java.util.*;
import java.math.*;
import java.io.*;


public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        int a[] = new int[5];
        for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 3928237;
        for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java import java.math.*; math.* java import java.io.*; io.* java public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        int a[] = new int[5];
        for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 3928237;
        for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        }
        System.out.println(ans);
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String args[]) {
        int a[] = new int[5];
        for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 3928237;
        for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        }
        System.out.println(ans);
    } main {
        int a[] = new int[5];
        for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 3928237;
        for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        }
        System.out.println(ans);
    } int a[] = new int[5]; a new int[5] 5 for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            a[i] = sc.nextInt();
        } {
            a[i] = sc.nextInt();
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int ans = 3928237; ans 3928237 for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        } {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        } int sum = 0; sum 0 for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            } int j = 0; int j = 0; j 0 j < 5 j 5 j++ j++ j {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            } {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            } if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                } i != j i j {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } sum += a[j] sum a[j] a j if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    } a[j] % 10 != 0 a[j] % 10 a[j] a j 10 0 {
                        sum += 10 - a[j] % 10;
                    } sum += 10 - a[j] % 10 sum 10 - a[j] % 10 10 a[j] % 10 a[j] a j 10 {
                    sum += a[j];
                } sum += a[j] sum a[j] a j ans = Math.min(ans,sum) ans Math.min(ans,sum) Math.min Math ans sum System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        int a[] = new int[5];
        for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 3928237;
        for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        }
        System.out.println(ans);
    }
} public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        int a[] = new int[5];
        for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 3928237;
        for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        }
        System.out.println(ans);
    }
} Main
import java.util.*;
import java.math.*;
import java.io.*;


public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]) {
        int a[] = new int[5];
        for(int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 3928237;
        for(int i = 0; i < 5; i++) {
            int sum = 0;
            for(int j = 0; j < 5; j++) {
                if(i != j) {
                    sum += a[j];
                    if(a[j] % 10 != 0) {
                        sum += 10 - a[j] % 10;
                    }
                } else {
                    sum += a[j];
                }
            }
            ans = Math.min(ans,sum);
        }
        System.out.println(ans);
    }
}