class Most_sum:
    def __init__(self):
        self.numbers = []

    def get_numbers(self):
        while True:
            number = input("Enter a number (or 'ok' to end): ")
            if number == 'ok':
                break
            else:
                self.numbers.append(int(number))

    def get_most_sum(self):
        i = 0
        first_sum = self.numbers[0]
        second_sum = self.numbers[0]
        while i < len(self.numbers) - 1:
            i = i + 1
            if first_sum < 0:
                first_sum = self.numbers[i]
            else:
                first_sum = first_sum + self.numbers[i]
            if first_sum > second_sum:
                second_sum = first_sum
            if second_sum < 0:
                second_sum = 0
        return second_sum


new_most_sum = Most_sum()
new_most_sum.get_numbers()
print(new_most_sum.get_most_sum())