import java.util.Scanner;

public class Main {

    static final int FIZZ_VAL = 3;
    static final int BUZZ_VAL = 5;

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        final int iInputVal = Integer.parseInt(sc.next());
        long lResult = 0;
        for (int iColumn = 1; iColumn <= iInputVal; iColumn++) {
            if (0 == isFizz(iColumn)) {
                continue;
            } else if (0 == isBuzz(iColumn)) {
                continue;
            } else if (0 == isFizz(iColumn) && 0 == isBuzz(iColumn)) {
                continue;
            }
            lResult += iColumn;
        }

        System.out.print(lResult);
    }

    private static int isFizz(final int iVal) {
        return iVal % FIZZ_VAL;
    }

    private static int isBuzz(final int iVal) {
        return iVal % BUZZ_VAL;
    }

}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz