Problem:
Rectangle

Write a program which calculates the area and perimeter of a given rectangle.

Input

The length a and breadth b of the rectangle are given in a line separated by a single space.

Output

Print the area and perimeter of the rectangle in a line. The two integers should be separated by a single space.

Constraints

1 ≤ a, b ≤ 100

Sample Input 1

3 5

Sample Output 1

15 16

Solution in JAVA (judge verdict: Accepted)

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String aStr = sc.next();
		String bStr= sc.next();
		int a = 0;
		int b = 0;
		try {
			a = Integer.parseInt(aStr);
			b = Integer.parseInt(bStr);
		} catch (Exception e) {
			System.out.println("error");
		}
		while (true) {
			if (a >= 1 && b <= 100) {
				int area = a * b;
				int circ = 2 * a + 2 * b;
				System.out.println(area + " " + circ);
				break;
			} else {
				continue;
			} 
		}
		sc.close();
	}
}