
# Summation  computes the summation, 0 + 1 + ..upto.. + n,
#   of a non-negative input int,  n.

n = int(raw_input("Type a nonnegative int: "))

if n < 0 :
    print "Sorry, negatives not allowed"
else :
   total = 0
   count = 0
   while count != n :
       # invariant:  total == 0 + 1 + ..upto.. + count

       print "count =", count, "; total =", total
       count = count + 1
       total = total + count

   # When the loop finishes, we have
   # (i) the invariant: total == 0 + 1 + ..upto.. + count
   # (ii) not(count != n), that is,  count==n
   #
   # We conclude: total == 0 + 1 + ..upto.. + n   
   # Success!

   print "FINISHED: count =", count, "; total =", total
   raw_input("Press Enter")