





"""simple docstring"""




from __future__ import annotations

import pandas as pd



def 					a__				(       snake_case__ ,				snake_case__ ,				snake_case__       )		->      Dict:
			lowerCamelCase       =      [0] * no_of_processes
			lowerCamelCase       =      [0] * no_of_processes
			# Copy the burst time into remaining_time[]
			for i in range(snake_case__       ):
						lowerCamelCase       =      burst_time[i]

			lowerCamelCase       =      0
			lowerCamelCase       =      0
			lowerCamelCase       =      9_99_99_99_99
			lowerCamelCase       =      0
			lowerCamelCase       =      False

			# Process until all processes are completed
			while complete != no_of_processes:
						for j in range(snake_case__       ):
									if arrival_time[j] <= increment_time and remaining_time[j] > 0:
												if remaining_time[j] < minm:
															lowerCamelCase       =      remaining_time[j]
															lowerCamelCase       =      j
															lowerCamelCase       =      True

						if not check:
									increment_time += 1
									continue
						remaining_time[short] -= 1

						lowerCamelCase       =      remaining_time[short]
						if minm == 0:
									lowerCamelCase       =      9_99_99_99_99

						if remaining_time[short] == 0:
									complete += 1
									lowerCamelCase       =      False

									# Find finish time of current process
									lowerCamelCase       =      increment_time + 1

									# Calculate waiting time
									lowerCamelCase       =      finish_time - arrival_time[short]
									lowerCamelCase       =      finar - burst_time[short]

									if waiting_time[short] < 0:
												lowerCamelCase       =      0

        # Increment time
						increment_time += 1
			return waiting_time



def 					a__				(       snake_case__ ,				snake_case__ ,				snake_case__       )		->      Optional[int]:
			lowerCamelCase       =      [0] * no_of_processes
			for i in range(snake_case__       ):
						lowerCamelCase       =      burst_time[i] + waiting_time[i]
			return turn_around_time



def 					a__				(       snake_case__ ,				snake_case__ ,				snake_case__       )		->      Optional[int]:
			lowerCamelCase       =      0
			lowerCamelCase       =      0
			for i in range(snake_case__       ):
						lowerCamelCase       =      total_waiting_time + waiting_time[i]
						lowerCamelCase       =      total_turn_around_time + turn_around_time[i]
			print(F'Average waiting time = {total_waiting_time / no_of_processes:.5f}'       )
			print("""Average turn around time =""" ,				total_turn_around_time / no_of_processes       )


if __name__ == "__main__":
					print("""Enter how many process you want to analyze""")
					lowerCAmelCase							:    Tuple  							=							int(input())
					lowerCAmelCase							:    Tuple  							=							[0] * no_of_processes
					lowerCAmelCase							:    Optional[int]  							=							[0] * no_of_processes
					lowerCAmelCase							:    int  							=							list(range(1, no_of_processes + 1))

					for i in range(no_of_processes):
										print("""Enter the arrival time and burst time for process:--""" + str(i + 1))
										lowerCAmelCase							:    Optional[int]  							=							map(int, input().split())

					lowerCAmelCase							:    str  							=							calculate_waitingtime(arrival_time, burst_time, no_of_processes)

					lowerCAmelCase							:    Any  							=							burst_time
					lowerCAmelCase							:    Dict  							=							no_of_processes
					lowerCAmelCase							:    Tuple  							=							waiting_time
					lowerCAmelCase							:    str  							=							calculate_turnaroundtime(bt, n, wt)

					calculate_average_times(waiting_time, turn_around_time, no_of_processes)

					lowerCAmelCase							:    Dict  							=							pd.DataFrame(
					    list(zip(processes, burst_time, arrival_time, waiting_time, turn_around_time)),
					    columns=[
					        """Process""",
					        """BurstTime""",
					        """ArrivalTime""",
					        """WaitingTime""",
					        """TurnAroundTime""",
					    ],
					)

					# Printing the dataFrame
					pd.set_option("""display.max_rows""", fcfs.shape[0] + 1)
					print(fcfs)









"""simple docstring"""




def 					a__				(       snake_case__ = 1_00_00_00       )		->      int:
			lowerCamelCase       =      1
			lowerCamelCase       =      1
			lowerCamelCase       =      {1: 1}

			for inputa in range(2 ,				snake_case__       ):
						lowerCamelCase       =      0
						lowerCamelCase       =      inputa

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

						if inputa not in counters:
									lowerCamelCase       =      counter

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


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



