using System;

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

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

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

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