import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc162_b solver = new abc162_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc162_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long N = in.nextLong();
            long fizzsum = 0;
            long buzzsum = 0;
            long fizzbuszsum = 0;
            long sum = 0;

            for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            }

        /*
        for (long i = 3; i <= N; i+=3) {
            if(i%15!=0) {
                fizzsum += i;
            }
        }
        for (long i = 5; i <= N; i+=5) {
            if(i%15!=0) {
                buzzsum += i;
            }
        }
        for (long i = 15; i <= N; i+=15) {
            fizzbuszsum+=i;
        }

         */
            out.println(sum);
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc162_b solver = new abc162_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc162_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long N = in.nextLong();
            long fizzsum = 0;
            long buzzsum = 0;
            long fizzbuszsum = 0;
            long sum = 0;

            for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            }

        /*
        for (long i = 3; i <= N; i+=3) {
            if(i%15!=0) {
                fizzsum += i;
            }
        }
        for (long i = 5; i <= N; i+=5) {
            if(i%15!=0) {
                buzzsum += i;
            }
        }
        for (long i = 15; i <= N; i+=15) {
            fizzbuszsum+=i;
        }

         */
            out.println(sum);
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc162_b solver = new abc162_b();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc162_b solver = new abc162_b();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) abc162_b solver = new abc162_b(); solver new abc162_b() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class abc162_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long N = in.nextLong();
            long fizzsum = 0;
            long buzzsum = 0;
            long fizzbuszsum = 0;
            long sum = 0;

            for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            }

        /*
        for (long i = 3; i <= N; i+=3) {
            if(i%15!=0) {
                fizzsum += i;
            }
        }
        for (long i = 5; i <= N; i+=5) {
            if(i%15!=0) {
                buzzsum += i;
            }
        }
        for (long i = 15; i <= N; i+=15) {
            fizzbuszsum+=i;
        }

         */
            out.println(sum);
        }

    } abc162_b public void solve(int testNumber, Scanner in, PrintWriter out) {
            long N = in.nextLong();
            long fizzsum = 0;
            long buzzsum = 0;
            long fizzbuszsum = 0;
            long sum = 0;

            for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            }

        /*
        for (long i = 3; i <= N; i+=3) {
            if(i%15!=0) {
                fizzsum += i;
            }
        }
        for (long i = 5; i <= N; i+=5) {
            if(i%15!=0) {
                buzzsum += i;
            }
        }
        for (long i = 15; i <= N; i+=15) {
            fizzbuszsum+=i;
        }

         */
            out.println(sum);
        } solve {
            long N = in.nextLong();
            long fizzsum = 0;
            long buzzsum = 0;
            long fizzbuszsum = 0;
            long sum = 0;

            for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            }

        /*
        for (long i = 3; i <= N; i+=3) {
            if(i%15!=0) {
                fizzsum += i;
            }
        }
        for (long i = 5; i <= N; i+=5) {
            if(i%15!=0) {
                buzzsum += i;
            }
        }
        for (long i = 15; i <= N; i+=15) {
            fizzbuszsum+=i;
        }

         */
            out.println(sum);
        } long N = in.nextLong(); N in.nextLong() in.nextLong in long fizzsum = 0; fizzsum 0 long buzzsum = 0; buzzsum 0 long fizzbuszsum = 0; fizzbuszsum 0 long sum = 0; sum 0 for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            } long i = 0; long i = 0; i 0 i <= N i N i++ i++ i {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            } {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            } if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                } (i % 3 == 0) && (i % 5 == 0) (i % 3 == 0) i % 3 i 3 0 (i % 5 == 0) i % 5 i 5 0 {
                    fizzbuszsum += i;
                } fizzbuszsum += i fizzbuszsum i if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                } i % 3 == 0 i % 3 i 3 0 {
                    fizzsum += i;
                } fizzsum += i fizzsum i if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                } i % 5 == 0 i % 5 i 5 0 {
                    buzzsum += i;
                } buzzsum += i buzzsum i {
                    sum += i;
                } sum += i sum i out.println(sum) out.println out sum int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc162_b solver = new abc162_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc162_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long N = in.nextLong();
            long fizzsum = 0;
            long buzzsum = 0;
            long fizzbuszsum = 0;
            long sum = 0;

            for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            }

        /*
        for (long i = 3; i <= N; i+=3) {
            if(i%15!=0) {
                fizzsum += i;
            }
        }
        for (long i = 5; i <= N; i+=5) {
            if(i%15!=0) {
                buzzsum += i;
            }
        }
        for (long i = 15; i <= N; i+=15) {
            fizzbuszsum+=i;
        }

         */
            out.println(sum);
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc162_b solver = new abc162_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc162_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long N = in.nextLong();
            long fizzsum = 0;
            long buzzsum = 0;
            long fizzbuszsum = 0;
            long sum = 0;

            for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            }

        /*
        for (long i = 3; i <= N; i+=3) {
            if(i%15!=0) {
                fizzsum += i;
            }
        }
        for (long i = 5; i <= N; i+=5) {
            if(i%15!=0) {
                buzzsum += i;
            }
        }
        for (long i = 15; i <= N; i+=15) {
            fizzbuszsum+=i;
        }

         */
            out.println(sum);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc162_b solver = new abc162_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc162_b {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long N = in.nextLong();
            long fizzsum = 0;
            long buzzsum = 0;
            long fizzbuszsum = 0;
            long sum = 0;

            for (long i = 0; i <= N; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                    fizzbuszsum += i;
                } else if (i % 3 == 0) {
                    fizzsum += i;
                } else if (i % 5 == 0) {
                    buzzsum += i;
                } else {
                    sum += i;
                }
            }

        /*
        for (long i = 3; i <= N; i+=3) {
            if(i%15!=0) {
                fizzsum += i;
            }
        }
        for (long i = 5; i <= N; i+=5) {
            if(i%15!=0) {
                buzzsum += i;
            }
        }
        for (long i = 15; i <= N; i+=15) {
            fizzbuszsum+=i;
        }

         */
            out.println(sum);
        }

    }
}

