using System;

class ArithmeticProgression : IProgression
{
    private int a0;
    private int b;

    public ArithmeticProgression(int a0, int b)
    {
        this.a0 = a0;
        this.b = b;
    }

    public int GetElement(int k)
    {
        return a0 + (k - 1) * b;
    }

    public int Sum(int n)
    {
        return (2 * a0 + (n - 1) * b) * n / 2;
    }
}
