#B4221. Simultaneous Green Light Problem

    ID: 11878 Type: Default 1000ms 256MiB

Simultaneous Green Light Problem

Simultaneous Green Light Problem

X has two traffic lights in front of his house. After finishing his math homework, he became curious and decided to observe the lights from his window. He noticed that both traffic lights have equal durations for their green and red phases. The first traffic light is green for $p$ seconds and then red for $p$ seconds, and this cycle repeats indefinitely. Similarly, the second traffic light is green for $q$ seconds and then red for $q$ seconds, repeating in the same manner.

At the moment of observation, both traffic lights switch from red to green simultaneously. Xiao X now wonders: in the next $2\,p\,q$ seconds (i.e. from time $0$ to $2pq-1$), how many seconds will both traffic lights be green at the same time?

Note: Time is measured in seconds.

inputFormat

The input consists of a single line containing two space-separated integers $p$ and $q$.

outputFormat

Output a single integer representing the number of seconds in the next $2\,p\,q$ seconds during which both traffic lights are green simultaneously.

sample

1 1
1