import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long num = Long.parseLong(scanner.nextLine());
        long total = 0;
        for (long i = 1; i <= num; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }
        System.out.println(total);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long num = Long.parseLong(scanner.nextLine());
        long total = 0;
        for (long i = 1; i <= num; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }
        System.out.println(total);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long num = Long.parseLong(scanner.nextLine());
        long total = 0;
        for (long i = 1; i <= num; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }
        System.out.println(total);
    } main {
        Scanner scanner = new Scanner(System.in);
        long num = Long.parseLong(scanner.nextLine());
        long total = 0;
        for (long i = 1; i <= num; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }
        System.out.println(total);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long num = Long.parseLong(scanner.nextLine()); num Long.parseLong(scanner.nextLine()) Long.parseLong Long scanner.nextLine() scanner.nextLine scanner long total = 0; total 0 for (long i = 1; i <= num; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        } long i = 1; long i = 1; i 1 i <= num i num i++ i++ i {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        } {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        } if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            } i % 3 != 0 && i % 5 != 0 i % 3 != 0 i % 3 i 3 0 i % 5 != 0 i % 5 i 5 0 {
                total += i;
            } total += i total i System.out.println(total) System.out.println System.out System System.out total String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long num = Long.parseLong(scanner.nextLine());
        long total = 0;
        for (long i = 1; i <= num; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }
        System.out.println(total);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long num = Long.parseLong(scanner.nextLine());
        long total = 0;
        for (long i = 1; i <= num; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }
        System.out.println(total);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long num = Long.parseLong(scanner.nextLine());
        long total = 0;
        for (long i = 1; i <= num; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }
        System.out.println(total);
    }
}