// Arup Guha
// 10/28/2017
// Solution to Junior Knights Loop Practice Program: Arithmetic Sequence Sum

import java.util.*;

public class sumseq {
	
	public static void main(String[] args) {
		
		// Get the parameters of the sequence.
		Scanner stdin = new Scanner(System.in);
		System.out.println("What is the first term of your sequence?");
		int term = stdin.nextInt();
		System.out.println("What is the common difference of your sequence?");
		int diff = stdin.nextInt();
		System.out.println("How many terms in the sequence?");
		int n = stdin.nextInt();
		
		// Our accumulator.
		int total = 0;
		
		System.out.print("Here is the sequence:");
		
		// Go through each term.
		for (int i=0; i<n; i++) {
			
			// Print it.
			System.out.print(" "+term);
			
			// Add to our total.
			total += term;
			
			// Advance to the next term.
			term += diff;
		}
		System.out.println();
		
		// Print out total.
		System.out.println("The sum of the sequence is "+total+".");
	}
}