from __future__ import annotations

import math


def      a__ (		__UpperCamelCase     ,      __UpperCamelCase				):
      SCREAMING_SNAKE_CASE_          =  u
      for i in range(1     ,      __UpperCamelCase				):
            SCREAMING_SNAKE_CASE_          =  temp * (u - i)
      return temp


def      a__ (		):
      SCREAMING_SNAKE_CASE_          =  int(input("enter the numbers of values: "				)				)
      SCREAMING_SNAKE_CASE_          =  []
      for _ in range(__UpperCamelCase				):
            y.append([]				)
      for i in range(__UpperCamelCase				):
            for j in range(__UpperCamelCase				):
                  y[i].append(__UpperCamelCase				)
                  SCREAMING_SNAKE_CASE_          =  0

      print("enter the values of parameters in a list: "				)
      SCREAMING_SNAKE_CASE_          =  list(map(__UpperCamelCase     ,      input().split()				)				)

      print("enter the values of corresponding parameters: "				)
      for i in range(__UpperCamelCase				):
            SCREAMING_SNAKE_CASE_          =  float(input()				)

      SCREAMING_SNAKE_CASE_          =  int(input("enter the value to interpolate: "				)				)
      SCREAMING_SNAKE_CASE_          =  (value - x[0]) / (x[1] - x[0])

      # for calculating forward difference table

      for i in range(1     ,      __UpperCamelCase				):
            for j in range(n - i				):
                  SCREAMING_SNAKE_CASE_          =  y[j + 1][i - 1] - y[j][i - 1]

      SCREAMING_SNAKE_CASE_          =  y[0][0]
      for i in range(1     ,      __UpperCamelCase				):
            summ += (ucal(__UpperCamelCase     ,      __UpperCamelCase				) * y[0][i]) / math.factorial(__UpperCamelCase				)

      print(F'''the value at {value} is {summ}'''				)


if __name__ == "__main__":
      main()



from __future__ import annotations


def      a__ (		__UpperCamelCase				):

      # preprocessing the first row
      for i in range(1     ,      len(matrix[0]				)				):
            matrix[0][i] += matrix[0][i - 1]

      # preprocessing the first column
      for i in range(1     ,      len(__UpperCamelCase				)				):
            matrix[i][0] += matrix[i - 1][0]

      # updating the path cost for current position
      for i in range(1     ,      len(__UpperCamelCase				)				):
            for j in range(1     ,      len(matrix[0]				)				):
                  matrix[i][j] += min(matrix[i - 1][j]     ,      matrix[i][j - 1]				)

      return matrix[-1][-1]


if __name__ == "__main__":
      import doctest

      doctest.testmod()


