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;
    }
  }
} import java.util.*; util.* java 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;
    }
  }
} 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);
  } main {
    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);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long quo = n / 15; quo n / 15 n 15 long rem = n % 15; rem n % 15 n 15 long laps = calcLaps(quo); laps calcLaps(quo) calcLaps quo long rems = calcRems(quo, rem); rems calcRems(quo, rem) calcRems quo rem System.out.println(laps + rems) System.out.println System.out System System.out laps + rems laps rems String[] args args private static long calcLaps(long quo) {
    if (quo == 0) {
      return 0;
    } else {
      long l = quo * quo;
      int aLap = 60;
      return aLap * l;
    }
  } calcLaps {
    if (quo == 0) {
      return 0;
    } else {
      long l = quo * quo;
      int aLap = 60;
      return aLap * l;
    }
  } if (quo == 0) {
      return 0;
    } else {
      long l = quo * quo;
      int aLap = 60;
      return aLap * l;
    } quo == 0 quo 0 {
      return 0;
    } return 0; 0 {
      long l = quo * quo;
      int aLap = 60;
      return aLap * l;
    } long l = quo * quo; l quo * quo quo quo int aLap = 60; aLap 60 return aLap * l; aLap * l aLap l long quo quo 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;
    }
  } calcRems {
    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;
    }
  } 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;
    } rem == 0 rem 0 {
      return 0;
    } return 0; 0 {
      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;
    } long lapBottom = 15 * quo; lapBottom 15 * quo 15 quo int i = 1; i 1 int valid = 0; valid 0 int fraction = 0; fraction 0 while (i <= rem) {
        if (i % 3 == 0 || i % 5 == 0){
          i++;
        } else {
          fraction += i;
          valid++;
          i++;
        }
      } i <= rem i rem {
        if (i % 3 == 0 || i % 5 == 0){
          i++;
        } else {
          fraction += i;
          valid++;
          i++;
        }
      } if (i % 3 == 0 || i % 5 == 0){
          i++;
        } else {
          fraction += i;
          valid++;
          i++;
        } i % 3 == 0 || i % 5 == 0 i % 3 == 0 i % 3 i 3 0 i % 5 == 0 i % 5 i 5 0 {
          i++;
        } i++ i {
          fraction += i;
          valid++;
          i++;
        } fraction += i fraction i valid++ valid i++ i return lapBottom * valid + fraction; lapBottom * valid + fraction lapBottom * valid lapBottom valid fraction long quo quo long rem rem
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;
    }
  }
}
