import java.util.*;

public class Main {

	public static long total(int n) {
		return (long)n * (long)(n + 1) / 2;
	}
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		long ans = 0;
		ans = total(n);
		long rest = 3 * total(n / 3);
		ans -= rest;
		rest = 5 * total(n / 5);
		ans -= rest;
		rest = 15 * total(n / 15);
		ans += rest;
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {

	public static long total(int n) {
		return (long)n * (long)(n + 1) / 2;
	}
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		long ans = 0;
		ans = total(n);
		long rest = 3 * total(n / 3);
		ans -= rest;
		rest = 5 * total(n / 5);
		ans -= rest;
		rest = 15 * total(n / 15);
		ans += rest;
		System.out.println(ans);
	}
} Main public static long total(int n) {
		return (long)n * (long)(n + 1) / 2;
	} total {
		return (long)n * (long)(n + 1) / 2;
	} return (long)n * (long)(n + 1) / 2; (long)n * (long)(n + 1) / 2 (long)n * (long)(n + 1) (long)n (long)(n + 1) n 1 2 int n n public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		long ans = 0;
		ans = total(n);
		long rest = 3 * total(n / 3);
		ans -= rest;
		rest = 5 * total(n / 5);
		ans -= rest;
		rest = 15 * total(n / 15);
		ans += rest;
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		long ans = 0;
		ans = total(n);
		long rest = 3 * total(n / 3);
		ans -= rest;
		rest = 5 * total(n / 5);
		ans -= rest;
		rest = 15 * total(n / 15);
		ans += rest;
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.close() sc.close sc long ans = 0; ans 0 ans = total(n) ans total(n) total n long rest = 3 * total(n / 3); rest 3 * total(n / 3) 3 total(n / 3) total n / 3 n 3 ans -= rest ans rest rest = 5 * total(n / 5) rest 5 * total(n / 5) 5 total(n / 5) total n / 5 n 5 ans -= rest ans rest rest = 15 * total(n / 15) rest 15 * total(n / 15) 15 total(n / 15) total n / 15 n 15 ans += rest ans rest System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {

	public static long total(int n) {
		return (long)n * (long)(n + 1) / 2;
	}
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		long ans = 0;
		ans = total(n);
		long rest = 3 * total(n / 3);
		ans -= rest;
		rest = 5 * total(n / 5);
		ans -= rest;
		rest = 15 * total(n / 15);
		ans += rest;
		System.out.println(ans);
	}
} public class Main {

	public static long total(int n) {
		return (long)n * (long)(n + 1) / 2;
	}
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		long ans = 0;
		ans = total(n);
		long rest = 3 * total(n / 3);
		ans -= rest;
		rest = 5 * total(n / 5);
		ans -= rest;
		rest = 15 * total(n / 15);
		ans += rest;
		System.out.println(ans);
	}
} Main
import java.util.*;

public class Main {

	public static long total(int n) {
		return (long)n * (long)(n + 1) / 2;
	}
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		long ans = 0;
		ans = total(n);
		long rest = 3 * total(n / 3);
		ans -= rest;
		rest = 5 * total(n / 5);
		ans -= rest;
		rest = 15 * total(n / 15);
		ans += rest;
		System.out.println(ans);
	}
}
