

def 							__lowerCAmelCase     (							_UpperCamelCase		:	Tuple = 10_00						)		->				Optional[int]:
 '''simple docstring'''


 SCREAMING_SNAKE_CASE		    =      3
 SCREAMING_SNAKE_CASE		    =      0
 while a < n:
  if a % 3 == 0 or a % 5 == 0:
   result += a
  elif a % 15 == 0:
   result -= a
  a += 1
 return result


if __name__ == "__main__":
      print(F"""{solution() = }""")





def  a   (lowerCAmelCase__ = 1_000_000   ):
   __a					=  1
   __a					=  1
   __a					=  {1: 1}

   for inputa in range(2		,				lowerCAmelCase__   ):
      __a					=  0
      __a					=  inputa

      while True:
         if number in counters:
            counter += counters[number]
            break
         if number % 2 == 0:
            number //= 2
            counter += 1
         else:
            __a					=  (3 * number) + 1
            counter += 1

      if inputa not in counters:
         __a					=  counter

      if counter > pre_counter:
         __a					=  inputa
         __a					=  counter
   return largest_number


if __name__ == "__main__":
  print(solution(int(input().strip())))



