import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextInt();
        long s = 0;
        long s2 = 0;
        for (int a=0; a<=A; a++) {
        	if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	}
        }
        System.out.println(s);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextInt();
        long s = 0;
        long s2 = 0;
        for (int a=0; a<=A; a++) {
        	if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	}
        }
        System.out.println(s);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextInt();
        long s = 0;
        long s2 = 0;
        for (int a=0; a<=A; a++) {
        	if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	}
        }
        System.out.println(s);
    } main {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextInt();
        long s = 0;
        long s2 = 0;
        for (int a=0; a<=A; a++) {
        	if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	}
        }
        System.out.println(s);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long A = sc.nextInt(); A sc.nextInt() sc.nextInt sc long s = 0; s 0 long s2 = 0; s2 0 for (int a=0; a<=A; a++) {
        	if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	}
        } int a=0; int a=0; a 0 a<=A a A a++ a++ a {
        	if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	}
        } {
        	if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	}
        } if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	} a % 3 == 0 || a % 5 == 0 a % 3 == 0 a % 3 a 3 0 a % 5 == 0 a % 5 a 5 0 {
        		s2 = a + s2;
        	} s2 = a + s2 s2 a + s2 a s2 {
        		s = a + s;
        	} s = a + s s a + s a s System.out.println(s) System.out.println System.out System System.out s String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextInt();
        long s = 0;
        long s2 = 0;
        for (int a=0; a<=A; a++) {
        	if(a % 3 == 0 || a % 5 == 0){
        		s2 = a + s2;
        	}
        	else {
        		s = a + s;
        	}
        }
        System.out.println(s);
    }
}