import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] times = {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        };
        int num = 0; 
        for (int t : times) {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        }

        int total = 0;
        for (int t : times) {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        }
        System.out.println(total);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] times = {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        };
        int num = 0; 
        for (int t : times) {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        }

        int total = 0;
        for (int t : times) {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        }
        System.out.println(total);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] times = {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        };
        int num = 0; 
        for (int t : times) {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        }

        int total = 0;
        for (int t : times) {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        }
        System.out.println(total);
    } main {
        Scanner sc = new Scanner(System.in);
        int[] times = {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        };
        int num = 0; 
        for (int t : times) {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        }

        int total = 0;
        for (int t : times) {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        }
        System.out.println(total);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] times = {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        }; times {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        } sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc int num = 0; num 0 for (int t : times) {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        } int t times {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        } {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        } int mod = t % 10; mod t % 10 t 10 if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            } mod != 0 mod 0 {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            } if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } num == 0 num 0 {
                    num = mod;
                } num = mod num mod if (num > mod) {
                    num = mod;
                } num > mod num mod {
                    num = mod;
                } num = mod num mod int total = 0; total 0 for (int t : times) {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        } int t times {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        } {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        } int mod = t % 10; mod t % 10 t 10 if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            } mod == 0 mod 0 {
                total += t;
            } total += t total t if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            } mod == num mod num {
                total += t;
                num = 0;
            } total += t total t num = 0 num 0 {
                total += (t + 10 - mod);
            } total += (t + 10 - mod) total (t + 10 - mod) t + 10 t 10 mod System.out.println(total) System.out.println System.out System System.out total String[] args args public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] times = {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        };
        int num = 0; 
        for (int t : times) {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        }

        int total = 0;
        for (int t : times) {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        }
        System.out.println(total);
    }
} public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] times = {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        };
        int num = 0; 
        for (int t : times) {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        }

        int total = 0;
        for (int t : times) {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        }
        System.out.println(total);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] times = {
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt(),
            sc.nextInt()
        };
        int num = 0; 
        for (int t : times) {
            int mod = t % 10;
            if (mod != 0) {
                if (num == 0) {
                    num = mod;
                } else if (num > mod) {
                    num = mod;
                } 
            }
        }

        int total = 0;
        for (int t : times) {
            int mod = t % 10;
            if (mod == 0) {
                total += t;
            } else if (mod == num ){
                total += t;
                num = 0;
            } else {
                total += (t + 10 - mod);
            }
        }
        System.out.println(total);
    }
}