Rectangles to squares

3.8

5 votes
Problem

You are given a rectangle of size m×n. You have to figure out if it is possible to divide the provided rectangle into equal-sized squares other than 1×1.

Print Yes if it is possible to perform the mentioned task. Otherwise, print No.

Input format

First line: Two space-separated integers m and n denoting the size of the rectangle

Output format

Print only one line containing Yes or No.

Constraints

1m,n1018

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

The given rectangle we have is of size 4 x 6.

                                   

Clearly, we can divide it in 6 equal squares of size 2 x 2.

Editor Image

?