import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        double cnt = 0;
        for (int i = 1; i <= n; ++i) {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        }
        DecimalFormat ft = new DecimalFormat("####");
        System.out.print(ft.format(cnt));
    }
} import java.text.DecimalFormat; DecimalFormat java.text import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        double cnt = 0;
        for (int i = 1; i <= n; ++i) {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        }
        DecimalFormat ft = new DecimalFormat("####");
        System.out.print(ft.format(cnt));
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        double cnt = 0;
        for (int i = 1; i <= n; ++i) {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        }
        DecimalFormat ft = new DecimalFormat("####");
        System.out.print(ft.format(cnt));
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        double cnt = 0;
        for (int i = 1; i <= n; ++i) {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        }
        DecimalFormat ft = new DecimalFormat("####");
        System.out.print(ft.format(cnt));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner double cnt = 0; cnt 0 for (int i = 1; i <= n; ++i) {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        } int i = 1; int i = 1; i 1 i <= n i n ++i ++i i {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        } {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        } if (i % 3 != 0 && i % 5 != 0)
                cnt += i; i % 3 != 0 && i % 5 != 0 i % 3 != 0 i % 3 i 3 0 i % 5 != 0 i % 5 i 5 0 cnt += i cnt i DecimalFormat ft = new DecimalFormat("####"); ft new DecimalFormat("####") System.out.print(ft.format(cnt)) System.out.print System.out System System.out ft.format(cnt) ft.format ft cnt String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        double cnt = 0;
        for (int i = 1; i <= n; ++i) {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        }
        DecimalFormat ft = new DecimalFormat("####");
        System.out.print(ft.format(cnt));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        double cnt = 0;
        for (int i = 1; i <= n; ++i) {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        }
        DecimalFormat ft = new DecimalFormat("####");
        System.out.print(ft.format(cnt));
    }
} Main
import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        double cnt = 0;
        for (int i = 1; i <= n; ++i) {
            if (i % 3 != 0 && i % 5 != 0)
                cnt += i;
        }
        DecimalFormat ft = new DecimalFormat("####");
        System.out.print(ft.format(cnt));
    }
}
