import java.util.Scanner;
public class Main {
	static int N;
	public static int dfs(int a) {
		if(a%3!=0&&a%5!=0) {
			return a;
		}
		else {
			return 0;
		}
	}
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		long ans=0;
		for(int i=0;i<N;i++) {
			ans+=dfs(N-i);
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	static int N;
	public static int dfs(int a) {
		if(a%3!=0&&a%5!=0) {
			return a;
		}
		else {
			return 0;
		}
	}
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		long ans=0;
		for(int i=0;i<N;i++) {
			ans+=dfs(N-i);
		}
		System.out.println(ans);
	}
} Main static int N; N public static int dfs(int a) {
		if(a%3!=0&&a%5!=0) {
			return a;
		}
		else {
			return 0;
		}
	} dfs {
		if(a%3!=0&&a%5!=0) {
			return a;
		}
		else {
			return 0;
		}
	} if(a%3!=0&&a%5!=0) {
			return a;
		}
		else {
			return 0;
		} a%3!=0&&a%5!=0 a%3!=0 a%3 a 3 0 a%5!=0 a%5 a 5 0 {
			return a;
		} return a; a {
			return 0;
		} return 0; 0 int a a public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		long ans=0;
		for(int i=0;i<N;i++) {
			ans+=dfs(N-i);
		}
		System.out.println(ans);
	} main {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		long ans=0;
		for(int i=0;i<N;i++) {
			ans+=dfs(N-i);
		}
		System.out.println(ans);
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) N=sc.nextInt() N sc.nextInt() sc.nextInt sc long ans=0; ans 0 for(int i=0;i<N;i++) {
			ans+=dfs(N-i);
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			ans+=dfs(N-i);
		} {
			ans+=dfs(N-i);
		} ans+=dfs(N-i) ans dfs(N-i) dfs N-i N i System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {
	static int N;
	public static int dfs(int a) {
		if(a%3!=0&&a%5!=0) {
			return a;
		}
		else {
			return 0;
		}
	}
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		long ans=0;
		for(int i=0;i<N;i++) {
			ans+=dfs(N-i);
		}
		System.out.println(ans);
	}
} public class Main {
	static int N;
	public static int dfs(int a) {
		if(a%3!=0&&a%5!=0) {
			return a;
		}
		else {
			return 0;
		}
	}
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		long ans=0;
		for(int i=0;i<N;i++) {
			ans+=dfs(N-i);
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;
public class Main {
	static int N;
	public static int dfs(int a) {
		if(a%3!=0&&a%5!=0) {
			return a;
		}
		else {
			return 0;
		}
	}
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		long ans=0;
		for(int i=0;i<N;i++) {
			ans+=dfs(N-i);
		}
		System.out.println(ans);
	}
}
