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;
    }

} import java.util.Scanner; Scanner java.util 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;
    }

} Main static final int FIZZ_VAL = 3; FIZZ_VAL 3 static final int BUZZ_VAL = 5; 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);
    } main {
        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);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int iInputVal = Integer.parseInt(sc.next()); iInputVal Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long lResult = 0; 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;
        } int iColumn = 1; int iColumn = 1; iColumn 1 iColumn <= iInputVal iColumn iInputVal iColumn++ iColumn++ iColumn {
            if (0 == isFizz(iColumn)) {
                continue;
            } else if (0 == isBuzz(iColumn)) {
                continue;
            } else if (0 == isFizz(iColumn) && 0 == isBuzz(iColumn)) {
                continue;
            }
            lResult += iColumn;
        } {
            if (0 == isFizz(iColumn)) {
                continue;
            } else if (0 == isBuzz(iColumn)) {
                continue;
            } else if (0 == isFizz(iColumn) && 0 == isBuzz(iColumn)) {
                continue;
            }
            lResult += iColumn;
        } if (0 == isFizz(iColumn)) {
                continue;
            } else if (0 == isBuzz(iColumn)) {
                continue;
            } else if (0 == isFizz(iColumn) && 0 == isBuzz(iColumn)) {
                continue;
            } 0 == isFizz(iColumn) 0 isFizz(iColumn) isFizz iColumn {
                continue;
            } continue; if (0 == isBuzz(iColumn)) {
                continue;
            } else if (0 == isFizz(iColumn) && 0 == isBuzz(iColumn)) {
                continue;
            } 0 == isBuzz(iColumn) 0 isBuzz(iColumn) isBuzz iColumn {
                continue;
            } continue; if (0 == isFizz(iColumn) && 0 == isBuzz(iColumn)) {
                continue;
            } 0 == isFizz(iColumn) && 0 == isBuzz(iColumn) 0 == isFizz(iColumn) 0 isFizz(iColumn) isFizz iColumn 0 == isBuzz(iColumn) 0 isBuzz(iColumn) isBuzz iColumn {
                continue;
            } continue; lResult += iColumn lResult iColumn System.out.print(lResult) System.out.print System.out System System.out lResult String[] args args private static int isFizz(final int iVal) {
        return iVal % FIZZ_VAL;
    } isFizz {
        return iVal % FIZZ_VAL;
    } return iVal % FIZZ_VAL; iVal % FIZZ_VAL iVal FIZZ_VAL final int iVal iVal private static int isBuzz(final int iVal) {
        return iVal % BUZZ_VAL;
    } isBuzz {
        return iVal % BUZZ_VAL;
    } return iVal % BUZZ_VAL; iVal % BUZZ_VAL iVal BUZZ_VAL final int iVal iVal 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;
    }

} 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;
    }

} Main
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;
    }

}
