import java.util.*;
 
public class Main { //クラス名はMain
    public static void main(String[] args) {
      //整数の入力
      Scanner sc = new Scanner(System.in);
      long n = Long.parseLong(sc.next());
      long total = 0;
      for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      }
      System.out.println(total);   
    }
} import java.util.*; util.* java public class Main { //クラス名はMain
    public static void main(String[] args) {
      //整数の入力
      Scanner sc = new Scanner(System.in);
      long n = Long.parseLong(sc.next());
      long total = 0;
      for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      }
      System.out.println(total);   
    }
} Main public static void main(String[] args) {
      //整数の入力
      Scanner sc = new Scanner(System.in);
      long n = Long.parseLong(sc.next());
      long total = 0;
      for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      }
      System.out.println(total);   
    } main {
      //整数の入力
      Scanner sc = new Scanner(System.in);
      long n = Long.parseLong(sc.next());
      long total = 0;
      for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      }
      System.out.println(total);   
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = Long.parseLong(sc.next()); n Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc long total = 0; total 0 for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      } long i=0; long i=0; i 0 i<=n i n i++ i++ i {
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      } {
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      } if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        } i % 3 == 0 || i % 5 == 0 i % 3 == 0 i % 3 i 3 0 i % 5 == 0 i % 5 i 5 0 {
        } {
          total += i;
        } total += i total i System.out.println(total) System.out.println System.out System System.out total String[] args args public class Main { //クラス名はMain
    public static void main(String[] args) {
      //整数の入力
      Scanner sc = new Scanner(System.in);
      long n = Long.parseLong(sc.next());
      long total = 0;
      for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      }
      System.out.println(total);   
    }
} public class Main { //クラス名はMain
    public static void main(String[] args) {
      //整数の入力
      Scanner sc = new Scanner(System.in);
      long n = Long.parseLong(sc.next());
      long total = 0;
      for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      }
      System.out.println(total);   
    }
} Main
import java.util.*;
 
public class Main { //クラス名はMain
    public static void main(String[] args) {
      //整数の入力
      Scanner sc = new Scanner(System.in);
      long n = Long.parseLong(sc.next());
      long total = 0;
      for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      }
      System.out.println(total);   
    }
}
