import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        long sum = 0;
        int n = Integer.parseInt(f.readLine());
        for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        }
        out.println(sum);
        out.close();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        long sum = 0;
        int n = Integer.parseInt(f.readLine());
        for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        }
        out.println(sum);
        out.close();
    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        long sum = 0;
        int n = Integer.parseInt(f.readLine());
        for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        }
        out.println(sum);
        out.close();
    } main {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        long sum = 0;
        int n = Integer.parseInt(f.readLine());
        for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        }
        out.println(sum);
        out.close();
    } BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); f new BufferedReader(new InputStreamReader(System.in)) PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); out new PrintWriter(new OutputStreamWriter(System.out)) long sum = 0; sum 0 int n = Integer.parseInt(f.readLine()); n Integer.parseInt(f.readLine()) Integer.parseInt Integer f.readLine() f.readLine f for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        } {
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        } if(i % 3 != 0 && i % 5 != 0) sum+=i; i % 3 != 0 && i % 5 != 0 i % 3 != 0 i % 3 i 3 0 i % 5 != 0 i % 5 i 5 0 sum+=i sum i out.println(sum) out.println out sum out.close() out.close out String[] args args public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        long sum = 0;
        int n = Integer.parseInt(f.readLine());
        for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        }
        out.println(sum);
        out.close();
    }
} public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        long sum = 0;
        int n = Integer.parseInt(f.readLine());
        for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        }
        out.println(sum);
        out.close();
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        long sum = 0;
        int n = Integer.parseInt(f.readLine());
        for(int i = 1; i <= n; i++){
            if(i % 3 != 0 && i % 5 != 0) sum+=i;
        }
        out.println(sum);
        out.close();
    }
}
