import java.util.Scanner;
public class Main {
public static void main(String[] args) {
MainRowRect bigRect = MainRowRect.byInput();
final int squareSideLength = bigRect.width.value;
Result result = new Result();
//最大正方形的所有组合
for (int sideLength1 = 1; sideLength1 <= squareSideLength; sideLength1++)
for (int sideLength2 = 1; sideLength2 <= squareSideLength; sideLength2++) {
SmallRect newRect = new SmallRect(sideLength1, sideLength2);
//在所有位置上放一遍
for (int y = 0; y < bigRect.height.value; y++)
for (int x = 0; x < bigRect.width.value; x++) {
newRect.leftTop = new Point(x, y);
if (bigRect.pIn(newRect.getRightBottom())) {
if (SmallRect.isSquare(newRect))
result.squareCount++;
else
result.boLongCount++;
}
}
}
System.out.println(result.squareCount + " " + result.boLongCount);
}
}
class Result {
int squareCount = 0, boLongCount = 0;
}
class SmallRect extends Rect {
Point leftTop;
SmallRect(int width, int height) {
super(width, height);
}
Point getRightBottom() {
return new Point(leftTop.x + width.value - 1, leftTop.y + height.value - 1);
}
}
abstract class Rect {
static boolean isSquare(Rect rect) {
return rect.height.value == rect.width.value;
}
Width width;
Height height;
Rect() {
}
Rect(int width, int height) {
this.width = new Width(width);
this.height = new Height(height);
}
}
class MainRowRect extends Rect {
static MainRowRect byInput() {
Scanner scanner = new Scanner(System.in);
return new MainRowRect(scanner.nextInt(), scanner.nextInt());
}
MainRowRect(int num1, int num2) {
if (num1 > num2) {
this.width = new Width(num1);
this.height = new Height(num2);
} else {
this.width = new Width(num2);
this.height = new Height(num1);
}
}
boolean pIn(Point p) {
return p.x >= 0 && p.y >= 0 && p.x < width.value && p.y < height.value;
}
}
class Point {
int x, y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
class Height extends Length {
Height(int value) {
super(value);
}
}
class Width extends Length {
Width(int value) {
super(value);
}
}
abstract class Length {
int value;
Length(int value) {
this.value = value;
}
}
能想到的最笨的解决方式