import java.util.*;

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

    int count = 5;
    int[] list = new int[count];
    for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    }

    int loss = 0;
    int maxLoss = 0;
    int result = 0;

    for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    }
    System.out.println(result - maxLoss);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int count = 5;
    int[] list = new int[count];
    for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    }

    int loss = 0;
    int maxLoss = 0;
    int result = 0;

    for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    }
    System.out.println(result - maxLoss);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int count = 5;
    int[] list = new int[count];
    for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    }

    int loss = 0;
    int maxLoss = 0;
    int result = 0;

    for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    }
    System.out.println(result - maxLoss);
  } main {
    Scanner sc = new Scanner(System.in);

    int count = 5;
    int[] list = new int[count];
    for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    }

    int loss = 0;
    int maxLoss = 0;
    int result = 0;

    for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    }
    System.out.println(result - maxLoss);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 5; count 5 int[] list = new int[count]; list new int[count] count for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
      list[i] = sc.nextInt();
    } {
      list[i] = sc.nextInt();
    } list[i] = sc.nextInt() list[i] list i sc.nextInt() sc.nextInt sc int loss = 0; loss 0 int maxLoss = 0; maxLoss 0 int result = 0; result 0 for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    } int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    } {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    } int order = list[i]; order list[i] list i if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      } order % 10 == 0 order % 10 order 10 0 {
        loss = 0;
      } loss = 0 loss 0 {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      } loss = 10 - (order % 10) loss 10 - (order % 10) 10 (order % 10) order 10 maxLoss = Math.max(loss, maxLoss) maxLoss Math.max(loss, maxLoss) Math.max Math loss maxLoss result += order + loss result order + loss order loss System.out.println(result - maxLoss) System.out.println System.out System System.out result - maxLoss result maxLoss String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int count = 5;
    int[] list = new int[count];
    for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    }

    int loss = 0;
    int maxLoss = 0;
    int result = 0;

    for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    }
    System.out.println(result - maxLoss);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int count = 5;
    int[] list = new int[count];
    for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    }

    int loss = 0;
    int maxLoss = 0;
    int result = 0;

    for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    }
    System.out.println(result - maxLoss);
  }
} Main
import java.util.*;

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

    int count = 5;
    int[] list = new int[count];
    for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    }

    int loss = 0;
    int maxLoss = 0;
    int result = 0;

    for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    }
    System.out.println(result - maxLoss);
  }
}
