import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long count = 0;
    long countA = 0;
    ArrayList<Long> a = new ArrayList<Long>();
    for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    }
        long print = 0;
        for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        }
        System.out.println(print);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long count = 0;
    long countA = 0;
    ArrayList<Long> a = new ArrayList<Long>();
    for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    }
        long print = 0;
        for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        }
        System.out.println(print);
  }
} Main public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long count = 0;
    long countA = 0;
    ArrayList<Long> a = new ArrayList<Long>();
    for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    }
        long print = 0;
        for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        }
        System.out.println(print);
  } main {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long count = 0;
    long countA = 0;
    ArrayList<Long> a = new ArrayList<Long>();
    for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    }
        long print = 0;
        for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        }
        System.out.println(print);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long N = sc.nextLong(); N sc.nextLong() sc.nextLong sc long count = 0; count 0 long countA = 0; countA 0 ArrayList<Long> a = new ArrayList<Long>(); a new ArrayList<Long>() for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    } long i = 0; long i = 0; i 0 i < N i N i++ i++ i {
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    } {
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    } count++ count if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        } count % 15 == 0 count % 15 count 15 0 {
            // System.out.print(count + ",");
            continue;
        } continue; if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        } count % 3 == 0 count % 3 count 3 0 {
            // System.out.print("Fizz");
            continue;
        } continue; if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        } count % 5 == 0 count % 5 count 5 0 {
            // System.out.print("Buzz");
            continue;
        } continue; a.add(count) a.add a count long print = 0; print 0 for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        } int i = 0; int i = 0; i 0 i < a.size() i a.size() a.size a i++ i++ i {
            print += a.get(i);
            // System.out.print(print);
        } {
            print += a.get(i);
            // System.out.print(print);
        } print += a.get(i) print a.get(i) a.get a i System.out.println(print) System.out.println System.out System System.out print String[] args args public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long count = 0;
    long countA = 0;
    ArrayList<Long> a = new ArrayList<Long>();
    for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    }
        long print = 0;
        for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        }
        System.out.println(print);
  }
} public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long count = 0;
    long countA = 0;
    ArrayList<Long> a = new ArrayList<Long>();
    for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    }
        long print = 0;
        for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        }
        System.out.println(print);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long count = 0;
    long countA = 0;
    ArrayList<Long> a = new ArrayList<Long>();
    for(long i = 0;i < N;i++){
        count++;
        if(count % 15 == 0){
            // System.out.print(count + ",");
            continue;
        } else if(count % 3 == 0){
            // System.out.print("Fizz");
            continue;
        } else if(count % 5 == 0){
            // System.out.print("Buzz");
            continue;
        }
            a.add(count);
    }
        long print = 0;
        for(int i = 0;i < a.size();i++){
            print += a.get(i);
            // System.out.print(print);
        }
        System.out.println(print);
  }
}
