
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        long sum = 0;
        for(int i = 0; i <=n; i++){
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        }
        System.out.println(sum);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        long sum = 0;
        for(int i = 0; i <=n; i++){
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        }
        System.out.println(sum);
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int n = sc.nextInt();
        long sum = 0;
        for(int i = 0; i <=n; i++){
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        }
        System.out.println(sum);
    } main {
        int n = sc.nextInt();
        long sum = 0;
        for(int i = 0; i <=n; i++){
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        }
        System.out.println(sum);
    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long sum = 0; sum 0 for(int i = 0; i <=n; i++){
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        } int i = 0; int i = 0; i 0 i <=n i n i++ i++ i {
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        } {
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        } if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            } !(i%3==0||i%5==0) (i%3==0||i%5==0) i%3==0 i%3 i 3 0 i%5==0 i%5 i 5 0 {
                //System.out.print(i+"\t");
                sum+=i;
            } sum+=i sum i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        long sum = 0;
        for(int i = 0; i <=n; i++){
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        }
        System.out.println(sum);
    }
} public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        long sum = 0;
        for(int i = 0; i <=n; i++){
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        }
        System.out.println(sum);
    }
} Main

import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        long sum = 0;
        for(int i = 0; i <=n; i++){
            if(!(i%3==0||i%5==0)){
                //System.out.print(i+"\t");
                sum+=i;
            }
        }
        System.out.println(sum);
    }
}