import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long N = sc.nextInt();

		String FizzBuzz = "";
		long SUM = 0;


		for(int i = 1; i <= N; i++) {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		}
		System.out.println(SUM);
		sc.close();
}
} import java.util.Scanner; Scanner java.util public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long N = sc.nextInt();

		String FizzBuzz = "";
		long SUM = 0;


		for(int i = 1; i <= N; i++) {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		}
		System.out.println(SUM);
		sc.close();
}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long N = sc.nextInt();

		String FizzBuzz = "";
		long SUM = 0;


		for(int i = 1; i <= N; i++) {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		}
		System.out.println(SUM);
		sc.close();
} main {
		Scanner sc = new Scanner(System.in);

		long N = sc.nextInt();

		String FizzBuzz = "";
		long SUM = 0;


		for(int i = 1; i <= N; i++) {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		}
		System.out.println(SUM);
		sc.close();
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String FizzBuzz = ""; FizzBuzz "" long SUM = 0; SUM 0 for(int i = 1; i <= N; i++) {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		} {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		} if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			} i % 3 ==0 && i % 5 ==0 i % 3 ==0 i % 3 i 3 0 i % 5 ==0 i % 5 i 5 0 {
				FizzBuzz = "FizzBuzz";
			} FizzBuzz = "FizzBuzz" FizzBuzz "FizzBuzz" if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			} i % 3 ==0 i % 3 i 3 0 {
				FizzBuzz = "FiZZ";
			} FizzBuzz = "FiZZ" FizzBuzz "FiZZ" if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			} i % 5 ==0 i % 5 i 5 0 {
				FizzBuzz = "Buzz";
			} FizzBuzz = "Buzz" FizzBuzz "Buzz" 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 SUM i System.out.println(SUM) System.out.println System.out System System.out SUM sc.close() sc.close sc String[] args args public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long N = sc.nextInt();

		String FizzBuzz = "";
		long SUM = 0;


		for(int i = 1; i <= N; i++) {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		}
		System.out.println(SUM);
		sc.close();
}
} public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long N = sc.nextInt();

		String FizzBuzz = "";
		long SUM = 0;


		for(int i = 1; i <= N; i++) {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		}
		System.out.println(SUM);
		sc.close();
}
} Main
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long N = sc.nextInt();

		String FizzBuzz = "";
		long SUM = 0;


		for(int i = 1; i <= N; i++) {

			if(i % 3 ==0 && i % 5 ==0) {
				FizzBuzz = "FizzBuzz";
			}
			else if(i % 3 ==0) {
				FizzBuzz = "FiZZ";
			}else if(i % 5 ==0) {
				FizzBuzz = "Buzz";
			}
			if(i%3 !=0 && i % 5 !=0) {
				SUM +=i;
			}
		}
		System.out.println(SUM);
		sc.close();
}
}
