# Author:
# Date: 4/18/25
# Exam 0, Problem 2 (7 of 20 points)

""" 
This program takes two positive integer arguments, n and k.
It calculates and prints the sum of the first n multiples of k.

For example,
>>> %Run p2.py 3 2
12

This returns 12 because the first 3 multiples of 2 are 2, 4, and 6; adding
these yields 12. A few more test cases:
>>> %Run p2.py 1 9
9
>>> %Run p2.py 10 2
110
>>> %Run p2.py 10 5
275
>>> %Run p2.py 4 141
1410

Write your code below:
"""

import sys

n = int(sys.argv[1])
k = int(sys.argv[2])

total = 0

for i in range(1, n+1):
    total += k * i

    
print(total)
    
