import java.util.*;
public class Main {// Main
    public static void main(String[] args){
       	Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long count = 0;
        for(int i=1;i<=a;i++) {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        }
        System.out.println(count);
    }
} import java.util.*; util.* java public class Main {// Main
    public static void main(String[] args){
       	Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long count = 0;
        for(int i=1;i<=a;i++) {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args){
       	Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long count = 0;
        for(int i=1;i<=a;i++) {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        }
        System.out.println(count);
    } main {
       	Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long count = 0;
        for(int i=1;i<=a;i++) {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        }
        System.out.println(count);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) long a = s.nextLong(); a s.nextLong() s.nextLong s long count = 0; count 0 for(int i=1;i<=a;i++) {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        } int i=1; int i=1; i 1 i<=a i a i++ i++ i {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        } {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        } if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            } i % 3 == 0 && i % 5 == 0 i % 3 == 0 i % 3 i 3 0 i % 5 == 0 i % 5 i 5 0 {

            } if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            } i % 3 == 0 i % 3 i 3 0 {

            } if(i % 5 == 0) {

            } else {
                count += i;
            } i % 5 == 0 i % 5 i 5 0 {

            } {
                count += i;
            } count += i count i System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {// Main
    public static void main(String[] args){
       	Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long count = 0;
        for(int i=1;i<=a;i++) {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        }
        System.out.println(count);
    }
} public class Main {// Main
    public static void main(String[] args){
       	Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long count = 0;
        for(int i=1;i<=a;i++) {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        }
        System.out.println(count);
    }
} Main
import java.util.*;
public class Main {// Main
    public static void main(String[] args){
       	Scanner s = new Scanner(System.in);
        long a = s.nextLong();
        long count = 0;
        for(int i=1;i<=a;i++) {
            if(i % 3 == 0 && i % 5 == 0) {

            } else if(i % 3 == 0) {

            } else if(i % 5 == 0) {

            } else {
                count += i;
            }
        }
        System.out.println(count);
    }
}
