import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 0;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
      int t = sc.nextInt();
      int ceil = (int)Math.ceil(t/10.0)*10;
      ans += ceil;
      max = Math.max(max, ceil-t);
    }
    System.out.println(ans-max);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 0;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
      int t = sc.nextInt();
      int ceil = (int)Math.ceil(t/10.0)*10;
      ans += ceil;
      max = Math.max(max, ceil-t);
    }
    System.out.println(ans-max);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 0;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
      int t = sc.nextInt();
      int ceil = (int)Math.ceil(t/10.0)*10;
      ans += ceil;
      max = Math.max(max, ceil-t);
    }
    System.out.println(ans-max);
  } main {
    Scanner sc = new Scanner(System.in);
    int max = 0;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
      int t = sc.nextInt();
      int ceil = (int)Math.ceil(t/10.0)*10;
      ans += ceil;
      max = Math.max(max, ceil-t);
    }
    System.out.println(ans-max);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int max = 0; max 0 int ans = 0; ans 0 for (int i = 0; i < 5; i++) {
      int t = sc.nextInt();
      int ceil = (int)Math.ceil(t/10.0)*10;
      ans += ceil;
      max = Math.max(max, ceil-t);
    } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
      int t = sc.nextInt();
      int ceil = (int)Math.ceil(t/10.0)*10;
      ans += ceil;
      max = Math.max(max, ceil-t);
    } {
      int t = sc.nextInt();
      int ceil = (int)Math.ceil(t/10.0)*10;
      ans += ceil;
      max = Math.max(max, ceil-t);
    } int t = sc.nextInt(); t sc.nextInt() sc.nextInt sc int ceil = (int)Math.ceil(t/10.0)*10; ceil (int)Math.ceil(t/10.0)*10 (int)Math.ceil(t/10.0) Math.ceil Math t/10.0 t 10.0 10 ans += ceil ans ceil max = Math.max(max, ceil-t) max Math.max(max, ceil-t) Math.max Math max ceil-t ceil t System.out.println(ans-max) System.out.println System.out System System.out ans-max ans max String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 0;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
      int t = sc.nextInt();
      int ceil = (int)Math.ceil(t/10.0)*10;
      ans += ceil;
      max = Math.max(max, ceil-t);
    }
    System.out.println(ans-max);
  }
}