import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();
		long fizzBuzzSum = 0;

		for (int i = 0; i <= number; i++) {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		}

		System.out.println(fizzBuzzSum);

		scanner.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();
		long fizzBuzzSum = 0;

		for (int i = 0; i <= number; i++) {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		}

		System.out.println(fizzBuzzSum);

		scanner.close();
	}

} Main public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();
		long fizzBuzzSum = 0;

		for (int i = 0; i <= number; i++) {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		}

		System.out.println(fizzBuzzSum);

		scanner.close();
	} main {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();
		long fizzBuzzSum = 0;

		for (int i = 0; i <= number; i++) {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		}

		System.out.println(fizzBuzzSum);

		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int number = scanner.nextInt(); number scanner.nextInt() scanner.nextInt scanner long fizzBuzzSum = 0; fizzBuzzSum 0 for (int i = 0; i <= number; i++) {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		} int i = 0; int i = 0; i 0 i <= number i number i++ i++ i {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		} {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		} if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			} i % 3 != 0 && i % 5 != 0 && i % 15 != 0 i % 3 != 0 && i % 5 != 0 && i % 15 != 0 i % 3 != 0 i % 3 i 3 0 i % 5 != 0 i % 5 i 5 0 i % 15 != 0 i % 15 i 15 0 {
				fizzBuzzSum = fizzBuzzSum + i;
			} fizzBuzzSum = fizzBuzzSum + i fizzBuzzSum fizzBuzzSum + i fizzBuzzSum i System.out.println(fizzBuzzSum) System.out.println System.out System System.out fizzBuzzSum scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();
		long fizzBuzzSum = 0;

		for (int i = 0; i <= number; i++) {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		}

		System.out.println(fizzBuzzSum);

		scanner.close();
	}

} public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();
		long fizzBuzzSum = 0;

		for (int i = 0; i <= number; i++) {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		}

		System.out.println(fizzBuzzSum);

		scanner.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int number = scanner.nextInt();
		long fizzBuzzSum = 0;

		for (int i = 0; i <= number; i++) {

			if (i % 3 != 0 && i % 5 != 0 && i % 15 != 0) {
				fizzBuzzSum = fizzBuzzSum + i;
			}

		}

		System.out.println(fizzBuzzSum);

		scanner.close();
	}

}
