import java.util.Scanner;

public class Main {
	private static long fizzbuzzSum(int number) {
		long sum = 0;
		for (int i = 1; i <= number; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		}
		return sum;
	}

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	private static long fizzbuzzSum(int number) {
		long sum = 0;
		for (int i = 1; i <= number; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		}
		return sum;
	}

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		}
	}
} Main private static long fizzbuzzSum(int number) {
		long sum = 0;
		for (int i = 1; i <= number; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		}
		return sum;
	} fizzbuzzSum {
		long sum = 0;
		for (int i = 1; i <= number; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		}
		return sum;
	} long sum = 0; sum 0 for (int i = 1; i <= number; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		} int i = 1; int i = 1; i 1 i <= number i number i++ i++ i {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		} {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		} if (i % 3 != 0 && i % 5 != 0)
				sum += i; i % 3 != 0 && i % 5 != 0 i % 3 != 0 i % 3 i 3 0 i % 5 != 0 i % 5 i 5 0 sum += i sum i return sum; sum int number number public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		} {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) System.out.println(fizzbuzzSum(scanner.nextInt())) System.out.println System.out System System.out fizzbuzzSum(scanner.nextInt()) fizzbuzzSum scanner.nextInt() scanner.nextInt scanner String[] args args public class Main {
	private static long fizzbuzzSum(int number) {
		long sum = 0;
		for (int i = 1; i <= number; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		}
		return sum;
	}

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		}
	}
} public class Main {
	private static long fizzbuzzSum(int number) {
		long sum = 0;
		for (int i = 1; i <= number; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		}
		return sum;
	}

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		}
	}
} Main
import java.util.Scanner;

public class Main {
	private static long fizzbuzzSum(int number) {
		long sum = 0;
		for (int i = 1; i <= number; i++) {
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		}
		return sum;
	}

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(fizzbuzzSum(scanner.nextInt()));
		}
	}
}
