#C9086. Tiling the Field with Largest Square Tiles

    ID: 53140 Type: Default 1000ms 256MiB

Tiling the Field with Largest Square Tiles

Tiling the Field with Largest Square Tiles

In this problem, you are given the dimensions of a rectangular field, described by two positive integers (w) (width) and (h) (height). Your task is to determine the side length of the largest square tile that can exactly cover the field without any leftover area. This means the square tile should be able to tile the entire field without any cut or waste. Mathematically, the side length of the largest such square is given by (\gcd(w, h)).

inputFormat

The input consists of a single line with two space-separated integers (w) and (h) representing the width and height of the field, respectively. (1 \leq w, h \leq 10^{9}).

outputFormat

Output a single integer denoting the side length of the largest square tile that can exactly cover the field.## sample

15 10
5

</p>