# Arup Guha
# 7/8/2013
# Sum of an arithmetic sequence

def main():

    # Get user input.
    first = int(input("What is the first term\n"))
    diff = int(input("What is the common difference\n"))
    n = int(input("How many terms?\n"))

    '''
    # Alternate way to sum. Loop variable is equal to what needs to be added.
    total = 0
    for num in range(first, first+n*diff, diff):
        total = total + num
    '''

    # Loop over number of terms, adding then getting the next term.
    total = 0
    for i in range(n):
        total = total + first
        first = first + diff
        
    print("Sum is "+str(total))

main()
