

'''simple docstring'''






import webbrowser
from sys import argv
from urllib.parse import parse_qs, quote

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
 lowerCAmelCase__											=	'''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(input('''Search: ''')))

 print('''Googling.....''')

 lowerCAmelCase__											=	f'https://www.google.com/search?q={query}&num=100'

 lowerCAmelCase__											=	requests.get(
     url,
     headers={'''User-Agent''': str(UserAgent().random)},
 )

 try:
  lowerCAmelCase__											=	(
      BeautifulSoup(res.text, '''html.parser''')
      .find('''div''', attrs={'''class''': '''yuRUbf'''})
      .find('''a''')
      .get('''href''')
  )

 except AttributeError:
  lowerCAmelCase__											=	parse_qs(
      BeautifulSoup(res.text, '''html.parser''')
      .find('''div''', attrs={'''class''': '''kCrYT'''})
      .find('''a''')
      .get('''href''')
  )['''url'''][0]

 webbrowser.open(link)


'''simple docstring'''




import os




def 							lowerCamelCase	(      UpperCAmelCase__       :					str = "input.txt" )			->      int:

							with open(os.path.join(os.path.dirname(UpperCAmelCase__ )      ,      UpperCAmelCase__ ) ) as input_file:
														lowercase_					:			str										=       [
														    [int(UpperCAmelCase__ ) for element in line.split(""",""" )]
														    for line in input_file.readlines()
														]

							lowercase_					:			Optional[Any]										=       len(UpperCAmelCase__ )
							lowercase_					:			Any										=       len(matrix[0] )

							lowercase_					:			Union[str, Any]										=       [[-1 for _ in range(UpperCAmelCase__ )] for _ in range(UpperCAmelCase__ )]
							for i in range(UpperCAmelCase__ ):
														lowercase_					:			int										=       matrix[i][0]

							for j in range(1      ,      UpperCAmelCase__ ):
														for i in range(UpperCAmelCase__ ):
																					lowercase_					:			Union[str, Any]										=       minimal_path_sums[i][j - 1] + matrix[i][j]

														for i in range(1      ,      UpperCAmelCase__ ):
																					lowercase_					:			Tuple										=       min(
																					    minimal_path_sums[i][j]      ,      minimal_path_sums[i - 1][j] + matrix[i][j] )

														for i in range(rows - 2      ,      -1      ,      -1 ):
																					lowercase_					:			Dict										=       min(
																					    minimal_path_sums[i][j]      ,      minimal_path_sums[i + 1][j] + matrix[i][j] )

							return min(minimal_path_sums_row[-1] for minimal_path_sums_row in minimal_path_sums )


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





