





'''simple docstring'''

import os
import random
import sys

from . import cryptomath_module as cryptomath
from . import rabin_miller

UpperCAmelCase					:		List[str]		=							3




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      print('''Generating primitive root of p'''	)
      while True:
            _snake_case		:	Tuple					     =     random.randrange(3			,      lowerCAmelCase_	)
            if pow(lowerCAmelCase_			,      2			,      lowerCAmelCase_	) == 1:
                  continue
            if pow(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	) == 1:
                  continue
            return g




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      print('''Generating prime p...'''	)
      _snake_case		:	str					     =     rabin_miller.generate_large_prime(lowerCAmelCase_	)  # select large prime number.
      _snake_case		:	int					     =     primitive_root(lowerCAmelCase_	)  # one primitive root on modulo p.
      _snake_case		:	Tuple					     =     random.randrange(3			,      lowerCAmelCase_	)  # private_key -> have to be greater than 2 for safety.
      _snake_case		:	Any					     =     cryptomath.find_mod_inverse(pow(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)			,      lowerCAmelCase_	)

      _snake_case		:	Optional[Any]					     =     (key_size, e_a, e_a, p)
      _snake_case		:	Optional[int]					     =     (key_size, d)

      return public_key, private_key




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      if os.path.exists(f'''{name}_pubkey.txt'''	) or os.path.exists(f'''{name}_privkey.txt'''	):
            print('''\nWARNING:'''	)
            print(
                f'''"{name}_pubkey.txt" or "{name}_privkey.txt" already exists. \n'''
                '''Use a different name or delete these files and re-run this program.'''	)
            sys.exit()

      _snake_case     ,							_snake_case		:	Tuple					     =     generate_key(lowerCAmelCase_	)
      print(f'''\nWriting public key to file {name}_pubkey.txt...'''	)
      with open(f'''{name}_pubkey.txt'''			,      '''w'''	) as fo:
            fo.write(f'''{public_key[0]},{public_key[1]},{public_key[2]},{public_key[3]}'''	)

      print(f'''Writing private key to file {name}_privkey.txt...'''	)
      with open(f'''{name}_privkey.txt'''			,      '''w'''	) as fo:
            fo.write(f'''{private_key[0]},{private_key[1]}'''	)




def    _a    (							):





      """simple docstring"""



      print('''Making key files...'''	)
      make_key_files('''elgamal'''			,      2_048	)
      print('''Key files generation successful'''	)


if __name__ == "__main__":
   main()









'''simple docstring'''

def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      if n == 1 or not isinstance(lowerCAmelCase_			,      lowerCAmelCase_	):
            return 0
      elif n == 2:
            return 1
      else:
            _snake_case		:	Union[str, Any]					     =     [0, 1]
            for i in range(2			,      n + 1	):
                  sequence.append(sequence[i - 1] + sequence[i - 2]	)

            return sequence[n]




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Optional[int]					     =     0
      _snake_case		:	int					     =     2

      while digits < n:
            index += 1
            _snake_case		:	Tuple					     =     len(str(fibonacci(lowerCAmelCase_	)	)	)

      return index




def    _a    (							lowerCAmelCase_ = 1_000	):





      """simple docstring"""



      return fibonacci_digits_index(lowerCAmelCase_	)


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


