


'''simple docstring'''

from __future__ import annotations

from collections.abc import Iterator
from typing import Generic, TypeVar

a_  :				Tuple						= TypeVar("""T""")





class      snake_case    (    Generic[T]			):





  """simple docstring"""




  def __init__(    self			,  UpperCamelCase     ):







   """simple docstring"""
   lowerCamelCase_      =  data
   lowerCamelCase_      =  None







  def __str__(    self     ):







   """simple docstring"""
   return f'''{self.data}'''





class      snake_case    (    Generic[T]			):





  """simple docstring"""




  def __init__(    self     ):







   """simple docstring"""
   lowerCamelCase_      =  None






  def __iter__(    self     ):







   """simple docstring"""
   lowerCamelCase_      =  self.top
   while node:
    yield node.data
    lowerCamelCase_      =  node.next






  def __str__(    self     ):







   """simple docstring"""
   return "->".join([str(UpperCamelCase     ) for item in self]     )






  def __len__(    self     ):







   """simple docstring"""
   return len(tuple(iter(self     )     )     )






  def   snake_case		(    self     ):







   """simple docstring"""
   return self.top is None






  def   snake_case		(    self			,  UpperCamelCase     ):







   """simple docstring"""
   lowerCamelCase_      =  Node(UpperCamelCase     )
   if not self.is_empty():
    lowerCamelCase_      =  self.top
   lowerCamelCase_      =  node






  def   snake_case		(    self     ):







   """simple docstring"""
   if self.is_empty():
    raise IndexError("pop from empty stack"     )
   assert isinstance(self.top			,  UpperCamelCase     )
   lowerCamelCase_      =  self.top
   lowerCamelCase_      =  self.top.next
   return pop_node.data






  def   snake_case		(    self     ):







   """simple docstring"""
   if self.is_empty():
    raise IndexError("peek from empty stack"     )

   assert self.top is not None
   return self.top.data







  def   snake_case		(    self     ):







   """simple docstring"""
   lowerCamelCase_      =  None


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

     testmod()







'''simple docstring'''

import os





def __snake_case					(      UpperCAmelCase_						:						str = "matrix.txt"		):
 with open(os.path.join(os.path.dirname(UpperCAmelCase_		)					,				UpperCAmelCase_		)		) as in_file:
  lowerCamelCase_      =  in_file.read()

 lowerCamelCase_      =  [[int(UpperCAmelCase_		) for cell in row.split(","		)] for row in data.strip().splitlines()]
 lowerCamelCase_      =  [[0 for cell in row] for row in grid]
 lowerCamelCase_      =  len(grid[0]		)

 lowerCamelCase_      =  [[0 for i in range(UpperCAmelCase_		)] for j in range(UpperCAmelCase_		)]
 lowerCamelCase_      =  grid[0][0]
 for i in range(1					,				UpperCAmelCase_		):
  lowerCamelCase_      =  grid[0][i] + dp[0][i - 1]
 for i in range(1					,				UpperCAmelCase_		):
  lowerCamelCase_      =  grid[i][0] + dp[i - 1][0]

 for i in range(1					,				UpperCAmelCase_		):
  for j in range(1					,				UpperCAmelCase_		):
   lowerCamelCase_      =  grid[i][j] + min(dp[i - 1][j]					,				dp[i][j - 1]		)

 return dp[-1][-1]


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



