import java.util.Scanner;
public class Main {
     public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        
        for(int i = 0;i < N;i++){
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        }
        
        System.out.print(ans);
     }
} import java.util.Scanner; Scanner java.util public class Main {
     public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        
        for(int i = 0;i < N;i++){
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        }
        
        System.out.print(ans);
     }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        
        for(int i = 0;i < N;i++){
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        }
        
        System.out.print(ans);
     } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        
        for(int i = 0;i < N;i++){
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        }
        
        System.out.print(ans);
     } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long ans = 0; ans 0 for(int i = 0;i < N;i++){
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        } {
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        } if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            } (i+1) % 3 == 0|| (i+1) % 5 == 0 (i+1) % 3 == 0 (i+1) % 3 (i+1) i 1 3 0 (i+1) % 5 == 0 (i+1) % 5 (i+1) i 1 5 0 {
                
            } {
                ans = ans + (i + 1);
            } ans = ans + (i + 1) ans ans + (i + 1) ans (i + 1) i 1 System.out.print(ans) System.out.print System.out System System.out ans String[] args args public class Main {
     public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        
        for(int i = 0;i < N;i++){
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        }
        
        System.out.print(ans);
     }
} public class Main {
     public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        
        for(int i = 0;i < N;i++){
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        }
        
        System.out.print(ans);
     }
} Main
import java.util.Scanner;
public class Main {
     public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long ans = 0;
        
        for(int i = 0;i < N;i++){
            if((i+1) % 3 == 0|| (i+1) % 5 == 0){
                
            }else{
                ans = ans + (i + 1);
            }
            //System.out.println(i + "=" + ans);
        }
        
        System.out.print(ans);
     }
}