
'''simple docstring'''

from __future__ import annotations

from queue import Queue







class 	__lowerCAmelCase    :



     def __init__(self	):
          _UpperCAmelCase					:  List[str]         =    {}



     def     snake_case_ (self	):
          for i in self.vertices:
               print(_UpperCAmelCase						,	""" : """						,	""" -> """.join([str(_UpperCAmelCase	) for j in self.vertices[i]]	)	)



     def     snake_case_ (self						,	lowerCAmelCase__						,	lowerCAmelCase__	):
          if from_vertex in self.vertices:
               self.vertices[from_vertex].append(_UpperCAmelCase	)
          else:
               _UpperCAmelCase					:  Optional[Any]         =    [to_vertex]



     def     snake_case_ (self						,	lowerCAmelCase__	):
          _UpperCAmelCase					:  Optional[Any]         =    set()

          # create a first in first out queue to store all the vertices for BFS
          _UpperCAmelCase					:  List[Any]         =    Queue()

          # mark the source node as visited and enqueue it
          visited.add(_UpperCAmelCase	)
          queue.put(_UpperCAmelCase	)

          while not queue.empty():
               _UpperCAmelCase					:  Tuple         =    queue.get()

               # loop through all adjacent vertex and enqueue it if not yet visited
               for adjacent_vertex in self.vertices[vertex]:
                    if adjacent_vertex not in visited:
                         queue.put(_UpperCAmelCase	)
                         visited.add(_UpperCAmelCase	)
          return visited


if __name__ == "__main__":
   from doctest import testmod

   testmod(verbose=True)

   lowerCAmelCase_			:			Dict			   =     Graph()
   g.add_edge(0, 1)
   g.add_edge(0, 2)
   g.add_edge(1, 2)
   g.add_edge(2, 0)
   g.add_edge(2, 3)
   g.add_edge(3, 3)

   g.print_graph()
   # 0  :  1 -> 2
   # 1  :  2
   # 2  :  0 -> 3
   # 3  :  3

   assert sorted(g.bfs(2)) == [0, 1, 2, 3]






def        __lowerCAmelCase    (SCREAMING_SNAKE_CASE = 1000					)->  int:




      """simple docstring"""

      snake_case_       =      0
      snake_case_       =      (n - 1) // 3
      total += ((terms) * (6 + (terms - 1) * 3)) // 2  # total of an A.P.
      snake_case_       =      (n - 1) // 5
      total += ((terms) * (10 + (terms - 1) * 5)) // 2
      snake_case_       =      (n - 1) // 15
      total -= ((terms) * (30 + (terms - 1) * 15)) // 2
      return total


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