import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[5];
    for (int i = 0; i < 5; i++) {
      a[i] = sc.nextInt();
    }
    Main abc123B = new Main();
    System.out.println(abc123B.solve(a));
  }

  public int solve(int[] a) {
    int ans = 0;
    int max_diff = 0;
    for(int i = 0; i < 5; i++ ){
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    }
    return ans - max_diff;
  }

  private int tenDiff(int a) {
    if (a % 10 == 0) {
      return 0;
    } else {
      return 10 - (a % 10);
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[5];
    for (int i = 0; i < 5; i++) {
      a[i] = sc.nextInt();
    }
    Main abc123B = new Main();
    System.out.println(abc123B.solve(a));
  }

  public int solve(int[] a) {
    int ans = 0;
    int max_diff = 0;
    for(int i = 0; i < 5; i++ ){
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    }
    return ans - max_diff;
  }

  private int tenDiff(int a) {
    if (a % 10 == 0) {
      return 0;
    } else {
      return 10 - (a % 10);
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[5];
    for (int i = 0; i < 5; i++) {
      a[i] = sc.nextInt();
    }
    Main abc123B = new Main();
    System.out.println(abc123B.solve(a));
  } main {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[5];
    for (int i = 0; i < 5; i++) {
      a[i] = sc.nextInt();
    }
    Main abc123B = new Main();
    System.out.println(abc123B.solve(a));
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] a = new int[5]; a new int[5] 5 for (int i = 0; i < 5; i++) {
      a[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
      a[i] = sc.nextInt();
    } {
      a[i] = sc.nextInt();
    } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc Main abc123B = new Main(); abc123B new Main() System.out.println(abc123B.solve(a)) System.out.println System.out System System.out abc123B.solve(a) abc123B.solve abc123B a String[] args args public int solve(int[] a) {
    int ans = 0;
    int max_diff = 0;
    for(int i = 0; i < 5; i++ ){
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    }
    return ans - max_diff;
  } solve {
    int ans = 0;
    int max_diff = 0;
    for(int i = 0; i < 5; i++ ){
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    }
    return ans - max_diff;
  } int ans = 0; ans 0 int max_diff = 0; max_diff 0 for(int i = 0; i < 5; i++ ){
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    } {
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    } int diff = tenDiff(a[i]); diff tenDiff(a[i]) tenDiff a[i] a i ans += a[i] + diff ans a[i] + diff a[i] a i diff if(diff > max_diff){
        max_diff = diff;
      } diff > max_diff diff max_diff {
        max_diff = diff;
      } max_diff = diff max_diff diff return ans - max_diff; ans - max_diff ans max_diff int[] a a private int tenDiff(int a) {
    if (a % 10 == 0) {
      return 0;
    } else {
      return 10 - (a % 10);
    }
  } tenDiff {
    if (a % 10 == 0) {
      return 0;
    } else {
      return 10 - (a % 10);
    }
  } if (a % 10 == 0) {
      return 0;
    } else {
      return 10 - (a % 10);
    } a % 10 == 0 a % 10 a 10 0 {
      return 0;
    } return 0; 0 {
      return 10 - (a % 10);
    } return 10 - (a % 10); 10 - (a % 10) 10 (a % 10) a 10 int a a public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[5];
    for (int i = 0; i < 5; i++) {
      a[i] = sc.nextInt();
    }
    Main abc123B = new Main();
    System.out.println(abc123B.solve(a));
  }

  public int solve(int[] a) {
    int ans = 0;
    int max_diff = 0;
    for(int i = 0; i < 5; i++ ){
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    }
    return ans - max_diff;
  }

  private int tenDiff(int a) {
    if (a % 10 == 0) {
      return 0;
    } else {
      return 10 - (a % 10);
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[5];
    for (int i = 0; i < 5; i++) {
      a[i] = sc.nextInt();
    }
    Main abc123B = new Main();
    System.out.println(abc123B.solve(a));
  }

  public int solve(int[] a) {
    int ans = 0;
    int max_diff = 0;
    for(int i = 0; i < 5; i++ ){
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    }
    return ans - max_diff;
  }

  private int tenDiff(int a) {
    if (a % 10 == 0) {
      return 0;
    } else {
      return 10 - (a % 10);
    }
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[5];
    for (int i = 0; i < 5; i++) {
      a[i] = sc.nextInt();
    }
    Main abc123B = new Main();
    System.out.println(abc123B.solve(a));
  }

  public int solve(int[] a) {
    int ans = 0;
    int max_diff = 0;
    for(int i = 0; i < 5; i++ ){
      int diff = tenDiff(a[i]);
      ans += a[i] + diff;
      if(diff > max_diff){
        max_diff = diff;
      }
    }
    return ans - max_diff;
  }

  private int tenDiff(int a) {
    if (a % 10 == 0) {
      return 0;
    } else {
      return 10 - (a % 10);
    }
  }
}
