# Arup Guha
# 6/13/2022
# Solution to Class Exercise: Sum Scores w/break
# Input ends with first negative integer.

# Will store total sum of grades.
total = 0

while True:

    score = int(input("What is the next grade?\n"))

    # This ends the list, get out now!
    if score < 0:
        break

    # Add score to our accumulator.
    total += score

# Print the total.
print("Sum of valid scores is", total)
