import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		long sum=0;
		long sum1=0;
		for(int i=1;i<=c;i++) {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		}
		System.out.println(sum-sum1);


	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		long sum=0;
		long sum1=0;
		for(int i=1;i<=c;i++) {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		}
		System.out.println(sum-sum1);


	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		long sum=0;
		long sum1=0;
		for(int i=1;i<=c;i++) {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		}
		System.out.println(sum-sum1);


	} main {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		long sum=0;
		long sum1=0;
		for(int i=1;i<=c;i++) {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		}
		System.out.println(sum-sum1);


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc long sum=0; sum 0 long sum1=0; sum1 0 for(int i=1;i<=c;i++) {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		} int i=1; int i=1; i 1 i<=c i c i++ i++ i {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		} {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		} sum+=i sum i if(i%3==0||i%5==0) {
				sum1+=i;
			} i%3==0||i%5==0 i%3==0 i%3 i 3 0 i%5==0 i%5 i 5 0 {
				sum1+=i;
			} sum1+=i sum1 i System.out.println(sum-sum1) System.out.println System.out System System.out sum-sum1 sum sum1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		long sum=0;
		long sum1=0;
		for(int i=1;i<=c;i++) {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		}
		System.out.println(sum-sum1);


	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		long sum=0;
		long sum1=0;
		for(int i=1;i<=c;i++) {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		}
		System.out.println(sum-sum1);


	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		long sum=0;
		long sum1=0;
		for(int i=1;i<=c;i++) {
			sum+=i;
			if(i%3==0||i%5==0) {
				sum1+=i;
			}
		}
		System.out.println(sum-sum1);


	}

}
