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

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int number = Integer.parseInt(br.readLine());
        long n = (long)number;
        BigInteger b = BigInteger.valueOf(n);
        BigInteger sum = BigInteger.ZERO;

        for(int i = 1; i <= number; i++){
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)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 import java.math.BigInteger; BigInteger java.math public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int number = Integer.parseInt(br.readLine());
        long n = (long)number;
        BigInteger b = BigInteger.valueOf(n);
        BigInteger sum = BigInteger.ZERO;

        for(int i = 1; i <= number; i++){
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        }
        System.out.println(sum);

    }
} Main public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int number = Integer.parseInt(br.readLine());
        long n = (long)number;
        BigInteger b = BigInteger.valueOf(n);
        BigInteger sum = BigInteger.ZERO;

        for(int i = 1; i <= number; i++){
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        }
        System.out.println(sum);

    } main {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int number = Integer.parseInt(br.readLine());
        long n = (long)number;
        BigInteger b = BigInteger.valueOf(n);
        BigInteger sum = BigInteger.ZERO;

        for(int i = 1; i <= number; i++){
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        }
        System.out.println(sum);

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int number = Integer.parseInt(br.readLine()); number Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br long n = (long)number; n (long)number BigInteger b = BigInteger.valueOf(n); b BigInteger.valueOf(n) BigInteger.valueOf BigInteger n BigInteger sum = BigInteger.ZERO; sum BigInteger.ZERO BigInteger BigInteger.ZERO for(int i = 1; i <= number; i++){
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        } int i = 1; int i = 1; i 1 i <= number i number i++ i++ i {
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        } {
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        } if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            } i%3 != 0 && i%5 != 0 i%3 != 0 i%3 i 3 0 i%5 != 0 i%5 i 5 0 {
                sum = sum.add(BigInteger.valueOf((long)i));
            } sum = sum.add(BigInteger.valueOf((long)i)) sum sum.add(BigInteger.valueOf((long)i)) sum.add sum BigInteger.valueOf((long)i) BigInteger.valueOf BigInteger (long)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 {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int number = Integer.parseInt(br.readLine());
        long n = (long)number;
        BigInteger b = BigInteger.valueOf(n);
        BigInteger sum = BigInteger.ZERO;

        for(int i = 1; i <= number; i++){
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        }
        System.out.println(sum);

    }
} public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int number = Integer.parseInt(br.readLine());
        long n = (long)number;
        BigInteger b = BigInteger.valueOf(n);
        BigInteger sum = BigInteger.ZERO;

        for(int i = 1; i <= number; i++){
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        }
        System.out.println(sum);

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

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int number = Integer.parseInt(br.readLine());
        long n = (long)number;
        BigInteger b = BigInteger.valueOf(n);
        BigInteger sum = BigInteger.ZERO;

        for(int i = 1; i <= number; i++){
            if(i%3 != 0 && i%5 != 0){
                sum = sum.add(BigInteger.valueOf((long)i));
            }
        }
        System.out.println(sum);

    }
}

