import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B= sc.nextInt(), C= sc.nextInt(), D= sc.nextInt(),
    E= sc.nextInt(), t=0, last = 0;
    int a = A % 10, b = B % 10, c = C % 10, d = D % 10, e = E % 10;
    if(a == 0 && b == 0 && c == 0 && d== 0 && e== 0) {
      t = A + B + C + D + E;
    } else {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    }
    System.out.println(t);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B= sc.nextInt(), C= sc.nextInt(), D= sc.nextInt(),
    E= sc.nextInt(), t=0, last = 0;
    int a = A % 10, b = B % 10, c = C % 10, d = D % 10, e = E % 10;
    if(a == 0 && b == 0 && c == 0 && d== 0 && e== 0) {
      t = A + B + C + D + E;
    } else {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    }
    System.out.println(t);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B= sc.nextInt(), C= sc.nextInt(), D= sc.nextInt(),
    E= sc.nextInt(), t=0, last = 0;
    int a = A % 10, b = B % 10, c = C % 10, d = D % 10, e = E % 10;
    if(a == 0 && b == 0 && c == 0 && d== 0 && e== 0) {
      t = A + B + C + D + E;
    } else {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    }
    System.out.println(t);
  } main {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B= sc.nextInt(), C= sc.nextInt(), D= sc.nextInt(),
    E= sc.nextInt(), t=0, last = 0;
    int a = A % 10, b = B % 10, c = C % 10, d = D % 10, e = E % 10;
    if(a == 0 && b == 0 && c == 0 && d== 0 && e== 0) {
      t = A + B + C + D + E;
    } else {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    }
    System.out.println(t);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt() A sc.nextInt() sc.nextInt sc B= sc.nextInt() B sc.nextInt() sc.nextInt sc C= sc.nextInt() C sc.nextInt() sc.nextInt sc D= sc.nextInt() D sc.nextInt() sc.nextInt sc E= sc.nextInt() E sc.nextInt() sc.nextInt sc t=0 t 0 last = 0; last 0 int a = A % 10 a A % 10 A 10 b = B % 10 b B % 10 B 10 c = C % 10 c C % 10 C 10 d = D % 10 d D % 10 D 10 e = E % 10; e E % 10 E 10 if(a == 0 && b == 0 && c == 0 && d== 0 && e== 0) {
      t = A + B + C + D + E;
    } else {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    } a == 0 && b == 0 && c == 0 && d== 0 && e== 0 d== 0 c == 0 a == 0 && b == 0 && c == 0 && d== 0 && e== 0 a == 0 a 0 b == 0 b 0 c == 0 c 0 d== 0 d 0 e== 0 e 0 {
      t = A + B + C + D + E;
    } t = A + B + C + D + E t A + B + C + D + E D C A + B + C + D + E A B C D E {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    } int[] X = { a, b, c, d, e }; X { a, b, c, d, e } a b c d e Arrays.sort(X) Arrays.sort Arrays X for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      } int i= 0; int i= 0; i 0 i<5 i 5 i++ i++ i {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      } {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      } if(X[i] != 0) {
          last = X[i];
          break;
        } X[i] != 0 X[i] X i 0 {
          last = X[i];
          break;
        } last = X[i] last X[i] X i break; if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      } a==0 a 0 {
        t += A;
      } t += A t A {
        t = t + A - a + 10;
      } t = t + A - a + 10 t t + A - a + 10 t + A - a t + A t A a 10 if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      } b==0 b 0 {
        t += B;
      } t += B t B {
        t = t + B - b + 10;
      } t = t + B - b + 10 t t + B - b + 10 t + B - b t + B t B b 10 if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      } c==0 c 0 {
        t += C;
      } t += C t C {
        t = t + C - c + 10;
      } t = t + C - c + 10 t t + C - c + 10 t + C - c t + C t C c 10 if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      } d==0 d 0 {
        t += D;
      } t += D t D {
        t = t + D - d + 10;
      } t = t + D - d + 10 t t + D - d + 10 t + D - d t + D t D d 10 if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      } e==0 e 0 {
        t += E;
      } t += E t E {
        t = t + E - e + 10;
      } t = t + E - e + 10 t t + E - e + 10 t + E - e t + E t E e 10 t = t-10 + last t t-10 + last t-10 t 10 last System.out.println(t) System.out.println System.out System System.out t String[] args args public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B= sc.nextInt(), C= sc.nextInt(), D= sc.nextInt(),
    E= sc.nextInt(), t=0, last = 0;
    int a = A % 10, b = B % 10, c = C % 10, d = D % 10, e = E % 10;
    if(a == 0 && b == 0 && c == 0 && d== 0 && e== 0) {
      t = A + B + C + D + E;
    } else {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    }
    System.out.println(t);
  }
} public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B= sc.nextInt(), C= sc.nextInt(), D= sc.nextInt(),
    E= sc.nextInt(), t=0, last = 0;
    int a = A % 10, b = B % 10, c = C % 10, d = D % 10, e = E % 10;
    if(a == 0 && b == 0 && c == 0 && d== 0 && e== 0) {
      t = A + B + C + D + E;
    } else {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    }
    System.out.println(t);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B= sc.nextInt(), C= sc.nextInt(), D= sc.nextInt(),
    E= sc.nextInt(), t=0, last = 0;
    int a = A % 10, b = B % 10, c = C % 10, d = D % 10, e = E % 10;
    if(a == 0 && b == 0 && c == 0 && d== 0 && e== 0) {
      t = A + B + C + D + E;
    } else {
      int[] X = { a, b, c, d, e }; 
      Arrays.sort(X);
      for(int i= 0; i<5; i++) {
        if(X[i] != 0) {
          last = X[i];
          break;
        }
      }
      if(a==0) {
        t += A;
      } else {
        t = t + A - a + 10;
      }
      if(b==0) {
        t += B;
      } else {
        t = t + B - b + 10;
      }
      if(c==0) {
        t += C;
      } else {
        t = t + C - c + 10;
      }
      if(d==0) {
        t += D;
      } else {
        t = t + D - d + 10;
      }
      if(e==0) {
        t += E;
      } else {
        t = t + E - e + 10;
      }
      t = t-10 + last;
    }
    System.out.println(t);
  }
}