import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

    public static void main(String[] args) throws IOException {
        // write your code here

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(reader.readLine());
        long sum=0;

        for (int i = 1; i <=n ; i++) {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        }

        System.out.println(sum);

    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{

    public static void main(String[] args) throws IOException {
        // write your code here

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(reader.readLine());
        long sum=0;

        for (int i = 1; i <=n ; i++) {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        }

        System.out.println(sum);

    }
} Main public static void main(String[] args) throws IOException {
        // write your code here

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(reader.readLine());
        long sum=0;

        for (int i = 1; i <=n ; i++) {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        }

        System.out.println(sum);

    } main {
        // write your code here

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(reader.readLine());
        long sum=0;

        for (int i = 1; i <=n ; i++) {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        }

        System.out.println(sum);

    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader long sum=0; sum 0 for (int i = 1; i <=n ; i++) {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        } int i = 1; int i = 1; i 1 i <=n i n i++ i++ i {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        } {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        } if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            } i%3==0 && i%5==0 i%3==0 i%3 i 3 0 i%5==0 i%5 i 5 0 {
                //System.out.println("FizzBuzz");
            } if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            } i%3==0 i%3 i 3 0 {
                //System.out.println("Fizz");
            } if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            } i%5==0 i%5 i 5 0 {
                //System.out.println("Buzz");
            } {
                sum+=i;
                //System.out.println(i);
            } sum+=i sum i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main{

    public static void main(String[] args) throws IOException {
        // write your code here

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(reader.readLine());
        long sum=0;

        for (int i = 1; i <=n ; i++) {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        }

        System.out.println(sum);

    }
} public class Main{

    public static void main(String[] args) throws IOException {
        // write your code here

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(reader.readLine());
        long sum=0;

        for (int i = 1; i <=n ; i++) {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        }

        System.out.println(sum);

    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

    public static void main(String[] args) throws IOException {
        // write your code here

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(reader.readLine());
        long sum=0;

        for (int i = 1; i <=n ; i++) {

            if(i%3==0 && i%5==0)
            {
                //System.out.println("FizzBuzz");
            }
            else if(i%3==0)
            {
                //System.out.println("Fizz");
            }
            else if(i%5==0)
            {
                //System.out.println("Buzz");
            }
            else
            {
                sum+=i;
                //System.out.println(i);
            }
        }

        System.out.println(sum);

    }
}
