Under construction

Still being built. Things may change

Packing snack sticks

Time limit2sMemory limit512 MB

Summary
Given n and m, decide whether an n by m grid can be tiled exactly with 3-cell straight bars and L trominoes that may be rotated.
Level

Medium4 of 10

Topics
Math, Greedy, Implementation, Combinatorics
Solved
No attempts yet

Problem

Donghyuk has a part time job packing snack sticks. There are two kinds of snack. One is a 3×13 \times 1 rectangle, and the other is an L shape left when one cell is removed from a 2×22 \times 2 square. Both kinds cover exactly three cells.

A stick shaped snack and an L shaped snack

A packing box is a grid of size n×mn \times m. The snacks break easily: if any gap is left in the box, they rattle and crack. The box therefore has to be filled completely. You may rotate a snack and you may use as many snacks of each kind as you want, but snacks must not overlap and must not stick out of the box. The picture below shows a 5×35 \times 3 box filled with no gaps.

A 5 by 3 box filled with snacks and no gaps

Given nn and mm, decide whether the box can be filled with no gaps.

Input

The first line contains the two side lengths nn and mm of the box, separated by a space. (1≤n,m≤5001 \le n, m \le 500)

Output

Print YES if the snacks can fill the box with no gaps, and NO otherwise.

Examples2

  1. Example 1

    Input
    5 3
    
    Expected output
    YES
    
  2. Example 2

    Input
    5 4
    
    Expected output
    NO