import java.util.Scanner;
class Main{
public static void main(String[] args){
 Scanner scan = new Scanner(System.in);
 
 int N = scan.nextInt();
 int FB[] = new int[N];
 long sum = 0;
  //配列にNまで代入
  for (int i = 0; i < N; i++){
    FB[i] = i + 1;
  }
  //文字へ置換
  for (int i = 0; i < N  ; i++){
   if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   }
    sum = sum + FB[i];
   }
  System.out.println(sum);
 }
} import java.util.Scanner; Scanner java.util class Main{
public static void main(String[] args){
 Scanner scan = new Scanner(System.in);
 
 int N = scan.nextInt();
 int FB[] = new int[N];
 long sum = 0;
  //配列にNまで代入
  for (int i = 0; i < N; i++){
    FB[i] = i + 1;
  }
  //文字へ置換
  for (int i = 0; i < N  ; i++){
   if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   }
    sum = sum + FB[i];
   }
  System.out.println(sum);
 }
} Main public static void main(String[] args){
 Scanner scan = new Scanner(System.in);
 
 int N = scan.nextInt();
 int FB[] = new int[N];
 long sum = 0;
  //配列にNまで代入
  for (int i = 0; i < N; i++){
    FB[i] = i + 1;
  }
  //文字へ置換
  for (int i = 0; i < N  ; i++){
   if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   }
    sum = sum + FB[i];
   }
  System.out.println(sum);
 } main {
 Scanner scan = new Scanner(System.in);
 
 int N = scan.nextInt();
 int FB[] = new int[N];
 long sum = 0;
  //配列にNまで代入
  for (int i = 0; i < N; i++){
    FB[i] = i + 1;
  }
  //文字へ置換
  for (int i = 0; i < N  ; i++){
   if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   }
    sum = sum + FB[i];
   }
  System.out.println(sum);
 } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int FB[] = new int[N]; FB new int[N] N long sum = 0; sum 0 for (int i = 0; i < N; i++){
    FB[i] = i + 1;
  } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
    FB[i] = i + 1;
  } {
    FB[i] = i + 1;
  } FB[i] = i + 1 FB[i] FB i i + 1 i 1 for (int i = 0; i < N  ; i++){
   if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   }
    sum = sum + FB[i];
   } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
   if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   }
    sum = sum + FB[i];
   } {
   if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   }
    sum = sum + FB[i];
   } if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   } FB[i] % 3 == 0 || FB[i] % 5 == 0 FB[i] % 3 == 0 FB[i] % 3 FB[i] FB i 3 0 FB[i] % 5 == 0 FB[i] % 5 FB[i] FB i 5 0 {
     FB[i] = 0;
   } FB[i] = 0 FB[i] FB i 0 sum = sum + FB[i] sum sum + FB[i] sum FB[i] FB i System.out.println(sum) System.out.println System.out System System.out sum String[] args args
import java.util.Scanner;
class Main{
public static void main(String[] args){
 Scanner scan = new Scanner(System.in);
 
 int N = scan.nextInt();
 int FB[] = new int[N];
 long sum = 0;
  //配列にNまで代入
  for (int i = 0; i < N; i++){
    FB[i] = i + 1;
  }
  //文字へ置換
  for (int i = 0; i < N  ; i++){
   if (FB[i] % 3 == 0 || FB[i] % 5 == 0){
     FB[i] = 0;
   }
    sum = sum + FB[i];
   }
  System.out.println(sum);
 }
}