





"""simple docstring"""
import unittest

from knapsack import greedy_knapsack as kp







class       a							(   unittest.TestCase  ):



 def    UpperCamelCase__  (     self     ):







  """simple docstring"""






  lowerCAmelCase    				= [10, 20, 30, 40, 50, 60]
  lowerCAmelCase    				= [2, 4, 6, 8, 10, 12]
  lowerCAmelCase    				= 1_00
  self.assertEqual(kp.calc_profit(_snake_case				,       _snake_case				,       _snake_case     )				,       2_10     )



 def    UpperCamelCase__  (     self     ):







  """simple docstring"""






  self.assertRaisesRegex(_snake_case				,       'max_weight must greater than zero.'     )



 def    UpperCamelCase__  (     self     ):







  """simple docstring"""






  self.assertRaisesRegex(_snake_case				,       'Weight can not be negative.'     )



 def    UpperCamelCase__  (     self     ):







  """simple docstring"""






  self.assertRaisesRegex(_snake_case				,       'Profit can not be negative.'     )



 def    UpperCamelCase__  (     self     ):







  """simple docstring"""






  self.assertRaisesRegex(_snake_case				,       'max_weight must greater than zero.'     )



 def    UpperCamelCase__  (     self     ):







  """simple docstring"""






  self.assertRaisesRegex(
      _snake_case				,       'The length of profit and weight must be same.'     )


if __name__ == "__main__":
       unittest.main()








from collections.abc import Sequence


def 							__lowerCAmelCase     (							_UpperCamelCase		:	Sequence[int] | None = None						)		->				int:
 '''simple docstring'''


 if nums is None or not nums:
  raise ValueError('Input sequence should not be empty'						)

 SCREAMING_SNAKE_CASE		    =      nums[0]
 for i in range(1		,				len(_UpperCamelCase						)						):
  SCREAMING_SNAKE_CASE		    =      nums[i]
  SCREAMING_SNAKE_CASE		    =      max(_UpperCamelCase		,				ans + num		,				_UpperCamelCase						)

 return ans


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      # Try on a sample input from the user
      a_     :    str     		=   int(input("Enter number of elements : ").strip())
      a_     :    Any     		=   list(map(int, input("\nEnter the numbers : ").strip().split()))[:n]
      print(max_subsequence_sum(array))

