import java.util.*;

public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 10;
        int minIndex = 0;
        for (int i = 0; i<5; i++) {
            a[i] = sc.nextInt();
            if (a[i]%10 != 0 && a[i]%10 < min) {
                min = a[i]%10;
                minIndex = i;
            } 
        }

        int result =0;
        if (min == 10) {
            for (int i = 0; i<5; i++) {
                result += a[i];
            }
        }
        else {
            for (int i = 0; i<5; i++) {
                result += a[i];
                if (a[i]%10 != 0 && i != minIndex) {
                    result += (10 - a[i]%10);
                }
            }
        }

        System.out.println(result);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 10;
        int minIndex = 0;
        for (int i = 0; i<5; i++) {
            a[i] = sc.nextInt();
            if (a[i]%10 != 0 && a[i]%10 < min) {
                min = a[i]%10;
                minIndex = i;
            } 
        }

        int result =0;
        if (min == 10) {
            for (int i = 0; i<5; i++) {
                result += a[i];
            }
        }
        else {
            for (int i = 0; i<5; i++) {
                result += a[i];
                if (a[i]%10 != 0 && i != minIndex) {
                    result += (10 - a[i]%10);
                }
            }
        }

        System.out.println(result);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 10;
        int minIndex = 0;
        for (int i = 0; i<5; i++) {
            a[i] = sc.nextInt();
            if (a[i]%10 != 0 && a[i]%10 < min) {
                min = a[i]%10;
                minIndex = i;
            } 
        }

        int result =0;
        if (min == 10) {
            for (int i = 0; i<5; i++) {
                result += a[i];
            }
        }
        else {
            for (int i = 0; i<5; i++) {
                result += a[i];
                if (a[i]%10 != 0 && i != minIndex) {
                    result += (10 - a[i]%10);
                }
            }
        }

        System.out.println(result);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 10;
        int minIndex = 0;
        for (int i = 0; i<5; i++) {
            a[i] = sc.nextInt();
            if (a[i]%10 != 0 && a[i]%10 < min) {
                min = a[i]%10;
                minIndex = i;
            } 
        }

        int result =0;
        if (min == 10) {
            for (int i = 0; i<5; i++) {
                result += a[i];
            }
        }
        else {
            for (int i = 0; i<5; i++) {
                result += a[i];
                if (a[i]%10 != 0 && i != minIndex) {
                    result += (10 - a[i]%10);
                }
            }
        }

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

        int result =0;
        if (min == 10) {
            for (int i = 0; i<5; i++) {
                result += a[i];
            }
        }
        else {
            for (int i = 0; i<5; i++) {
                result += a[i];
                if (a[i]%10 != 0 && i != minIndex) {
                    result += (10 - a[i]%10);
                }
            }
        }

        System.out.println(result);
        sc.close();
    }
} public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 10;
        int minIndex = 0;
        for (int i = 0; i<5; i++) {
            a[i] = sc.nextInt();
            if (a[i]%10 != 0 && a[i]%10 < min) {
                min = a[i]%10;
                minIndex = i;
            } 
        }

        int result =0;
        if (min == 10) {
            for (int i = 0; i<5; i++) {
                result += a[i];
            }
        }
        else {
            for (int i = 0; i<5; i++) {
                result += a[i];
                if (a[i]%10 != 0 && i != minIndex) {
                    result += (10 - a[i]%10);
                }
            }
        }

        System.out.println(result);
        sc.close();
    }
} Main
import java.util.*;

public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 10;
        int minIndex = 0;
        for (int i = 0; i<5; i++) {
            a[i] = sc.nextInt();
            if (a[i]%10 != 0 && a[i]%10 < min) {
                min = a[i]%10;
                minIndex = i;
            } 
        }

        int result =0;
        if (min == 10) {
            for (int i = 0; i<5; i++) {
                result += a[i];
            }
        }
        else {
            for (int i = 0; i<5; i++) {
                result += a[i];
                if (a[i]%10 != 0 && i != minIndex) {
                    result += (10 - a[i]%10);
                }
            }
        }

        System.out.println(result);
        sc.close();
    }
}