
import java.math.BigDecimal;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        //入力
    	Scanner sc = new Scanner(System.in);
    	int val = sc.nextInt();
    	double sum = 0;
    	for(int i =1; i <= val; i++) {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	}
    	System.out.println(BigDecimal.valueOf(sum).setScale(0).toPlainString());
    }
} import java.math.BigDecimal; BigDecimal java.math import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        //入力
    	Scanner sc = new Scanner(System.in);
    	int val = sc.nextInt();
    	double sum = 0;
    	for(int i =1; i <= val; i++) {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	}
    	System.out.println(BigDecimal.valueOf(sum).setScale(0).toPlainString());
    }
} Main public static void main(String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args void run() {
        //入力
    	Scanner sc = new Scanner(System.in);
    	int val = sc.nextInt();
    	double sum = 0;
    	for(int i =1; i <= val; i++) {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	}
    	System.out.println(BigDecimal.valueOf(sum).setScale(0).toPlainString());
    } run {
        //入力
    	Scanner sc = new Scanner(System.in);
    	int val = sc.nextInt();
    	double sum = 0;
    	for(int i =1; i <= val; i++) {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	}
    	System.out.println(BigDecimal.valueOf(sum).setScale(0).toPlainString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int val = sc.nextInt(); val sc.nextInt() sc.nextInt sc double sum = 0; sum 0 for(int i =1; i <= val; i++) {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	} int i =1; int i =1; i 1 i <= val i val i++ i++ i {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	} {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	} 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(BigDecimal.valueOf(sum).setScale(0).toPlainString()) System.out.println System.out System System.out BigDecimal.valueOf(sum).setScale(0).toPlainString() BigDecimal.valueOf(sum).setScale(0).toPlainString BigDecimal.valueOf(sum).setScale(0) BigDecimal.valueOf(sum).setScale BigDecimal.valueOf(sum) BigDecimal.valueOf BigDecimal sum 0 public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        //入力
    	Scanner sc = new Scanner(System.in);
    	int val = sc.nextInt();
    	double sum = 0;
    	for(int i =1; i <= val; i++) {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	}
    	System.out.println(BigDecimal.valueOf(sum).setScale(0).toPlainString());
    }
} public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        //入力
    	Scanner sc = new Scanner(System.in);
    	int val = sc.nextInt();
    	double sum = 0;
    	for(int i =1; i <= val; i++) {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	}
    	System.out.println(BigDecimal.valueOf(sum).setScale(0).toPlainString());
    }
} Main

import java.math.BigDecimal;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        //入力
    	Scanner sc = new Scanner(System.in);
    	int val = sc.nextInt();
    	double sum = 0;
    	for(int i =1; i <= val; i++) {
    		if(i % 3 != 0 && i % 5 !=0) {
    			sum += i;
    		}
    	}
    	System.out.println(BigDecimal.valueOf(sum).setScale(0).toPlainString());
    }
}