import java.util.Scanner;

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

    long p = 1;
    long sum = 0;
    for (int i = 0; i < n; i++) {
      if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      }
    }
    System.out.println(sum);
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    sc.close();

    long p = 1;
    long sum = 0;
    for (int i = 0; i < n; i++) {
      if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      }
    }
    System.out.println(sum);
  }
} Main public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    sc.close();

    long p = 1;
    long sum = 0;
    for (int i = 0; i < n; i++) {
      if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      }
    }
    System.out.println(sum);
  } main {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    sc.close();

    long p = 1;
    long sum = 0;
    for (int i = 0; i < n; i++) {
      if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      }
    }
    System.out.println(sum);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc sc.close() sc.close sc long p = 1; p 1 long sum = 0; sum 0 for (int i = 0; i < n; i++) {
      if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      }
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      }
    } {
      if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      }
    } if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      } p%5 == 0 || p%3 == 0 p%5 == 0 p%5 p 5 0 p%3 == 0 p%3 p 3 0 {
        p++;
        continue;
      } p++ p continue; {
        sum += p;
        p++;
      } sum += p sum p p++ p System.out.println(sum) System.out.println System.out System System.out sum String args[] args
import java.util.Scanner;

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

    long p = 1;
    long sum = 0;
    for (int i = 0; i < n; i++) {
      if (p%5 == 0 || p%3 == 0) {
        p++;
        continue;
      } else {
        sum += p;
        p++;
      }
    }
    System.out.println(sum);
  }
}