import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    }
  }
} Main public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    }
  } main {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    }
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) while (in.hasNext()) {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    } in.hasNext() in.hasNext in {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    } int maxRemain = 0; maxRemain 0 int sum = 0; sum 0 for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      } int i = 0; int i = 0; i 0 i < 5 i 5 ++i ++i i {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      } {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      } int dish = in.nextInt(); dish in.nextInt() in.nextInt in int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0; remain dish % 10 > 0 ? 10 - (dish % 10) : 0 dish % 10 > 0 dish % 10 dish 10 0 10 - (dish % 10) 10 (dish % 10) dish 10 0 maxRemain = Math.max(maxRemain, remain) maxRemain Math.max(maxRemain, remain) Math.max Math maxRemain remain sum += dish + remain sum dish + remain dish remain sum -= maxRemain sum maxRemain System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    }
  }
} public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    }
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      int maxRemain = 0;
      int sum = 0;

      for (int i = 0; i < 5; ++i) {
        int dish = in.nextInt();
        int remain = dish % 10 > 0 ? 10 - (dish % 10) : 0;
        maxRemain = Math.max(maxRemain, remain);
        sum += dish + remain;
      }
      
      sum -= maxRemain;
      
      System.out.println(sum);
    }
  }
}