import java.util.*;


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

    long quo = n / 15;
    long rem = n % 15;
    long laps = calcLaps(quo);
    long rems = calcRems(quo, rem);

    System.out.println(laps + rems);
  }

  private static long calcLaps(long quo) {
    if (quo == 0) {
      return 0;
    } else {
      long l = quo * quo;
      int aLap = 60;
      return aLap * l;
    }
  }

  private static long calcRems(long quo, long rem) {
    if (rem == 0) {
      return 0;
    } else {
      long lapBottom = 15 * quo;
      int i = 1;
      int valid = 0;
      int fraction = 0;

      while (i <= rem) {
        if (i % 3 == 0 || i % 5 == 0){
          i++;
        } else {
          fraction += i;
          valid++;
          i++;
        }
      }
      return lapBottom * valid + fraction;
    }
  }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz