package lab2;

import java.util.Scanner;

public class Example7 {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        // Timus 1000 — A + B
        int a = in.nextInt();
        int b = in.nextInt();
        System.out.println(a + b);

        // Timus 1068 — Sum
        int n = in.nextInt();
        int sum = 0;

        if (n > 0) {
            for (int i = 1; i <= n; i++) {
                sum += i;
            }
        } else {
            for (int i = n; i <= 1; i++) {
                sum += i;
            }
        }
        System.out.println(sum);

        // Timus 1204 — Idempotents
        long x = in.nextLong();
        System.out.println(x * x + 1);

        in.close();
    }
}
