import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int count = 0;
        int[] f = new int[5];
        for (int i = 0; i < 10; i++) {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        }
        Arrays.sort(f);
        int max = f[4];
        int ans = a + b + c + d + e - max;
        System.out.println(ans);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int count = 0;
        int[] f = new int[5];
        for (int i = 0; i < 10; i++) {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        }
        Arrays.sort(f);
        int max = f[4];
        int ans = a + b + c + d + e - max;
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int count = 0;
        int[] f = new int[5];
        for (int i = 0; i < 10; i++) {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        }
        Arrays.sort(f);
        int max = f[4];
        int ans = a + b + c + d + e - max;
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int count = 0;
        int[] f = new int[5];
        for (int i = 0; i < 10; i++) {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        }
        Arrays.sort(f);
        int max = f[4];
        int ans = a + b + c + d + e - max;
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc int count = 0; count 0 int[] f = new int[5]; f new int[5] 5 for (int i = 0; i < 10; i++) {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        } int i = 0; int i = 0; i 0 i < 10 i 10 i++ i++ i {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        } {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        } if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            } a % 10 != 0 a % 10 a 10 0 a++ a {
                f[0] = i;
                break;
            } f[0] = i f[0] f 0 i break; for (int i = 0; i < 10; i++) {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        } int i = 0; int i = 0; i 0 i < 10 i 10 i++ i++ i {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        } {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        } if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            } b % 10 != 0 b % 10 b 10 0 b++ b {
                f[1] = i;
                break;
            } f[1] = i f[1] f 1 i break; for (int i = 0; i < 10; i++) {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        } int i = 0; int i = 0; i 0 i < 10 i 10 i++ i++ i {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        } {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        } if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            } c % 10 != 0 c % 10 c 10 0 c++ c {
                f[2] = i;
                break;
            } f[2] = i f[2] f 2 i break; for (int i = 0; i < 10; i++) {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        } int i = 0; int i = 0; i 0 i < 10 i 10 i++ i++ i {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        } {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        } if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            } d % 10 != 0 d % 10 d 10 0 d++ d {
                f[3] = i;
                break;
            } f[3] = i f[3] f 3 i break; for (int i = 0; i < 10; i++) {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        } int i = 0; int i = 0; i 0 i < 10 i 10 i++ i++ i {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        } {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        } if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            } e % 10 != 0 e % 10 e 10 0 e++ e {
                f[4] = i;
                break;
            } f[4] = i f[4] f 4 i break; Arrays.sort(f) Arrays.sort Arrays f int max = f[4]; max f[4] f 4 int ans = a + b + c + d + e - max; ans a + b + c + d + e - max a + b + c + d + e d c a + b + c + d + e a b c d e max System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int count = 0;
        int[] f = new int[5];
        for (int i = 0; i < 10; i++) {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        }
        Arrays.sort(f);
        int max = f[4];
        int ans = a + b + c + d + e - max;
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int count = 0;
        int[] f = new int[5];
        for (int i = 0; i < 10; i++) {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        }
        Arrays.sort(f);
        int max = f[4];
        int ans = a + b + c + d + e - max;
        System.out.println(ans);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int count = 0;
        int[] f = new int[5];
        for (int i = 0; i < 10; i++) {
            if(a % 10 != 0) a++;
            else {
                f[0] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(b % 10 != 0) b++;
            else {
                f[1] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(c % 10 != 0) c++;
            else {
                f[2] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(d % 10 != 0) d++;
            else {
                f[3] = i;
                break;
            }
        }
        for (int i = 0; i < 10; i++) {
            if(e % 10 != 0) e++;
            else {
                f[4] = i;
                break;
            }
        }
        Arrays.sort(f);
        int max = f[4];
        int ans = a + b + c + d + e - max;
        System.out.println(ans);
    }
}