#C7835. Wall Coverage with Square Frames

    ID: 51750 Type: Default 1000ms 256MiB

Wall Coverage with Square Frames

Wall Coverage with Square Frames

You are given a wall of dimensions \(w\) (width) and \(h\) (height). You also have square picture frames with side length \(f\). Determine whether the wall can be completely covered by these frames without any overlaps and without rotating the frames.

The wall can be exactly covered if and only if both the width and the height of the wall are divisible by the side length of the frame. In mathematical terms, the wall can be covered if and only if:

[ w \bmod f = 0 \quad \text{and} \quad h \bmod f = 0 ]

If the conditions are satisfied, output YES, otherwise output NO.

inputFormat

The input is read from standard input (stdin) and consists of three integers separated by spaces:

  • w: the width of the wall.
  • h: the height of the wall.
  • f: the side length of the square frame.

For example:

8 12 4

outputFormat

Output a single line to standard output (stdout) containing either YES if the wall can be completely covered by the frames, or NO otherwise.

## sample
8 12 4
YES