This page is still under construction.

Parts of this page are still being built. What you see may change.

Two Slicers

Time limit2sMemory limit512 MB

Summary
Two slicers cut a unit circular cake into a and b equal sectors; rotate one relative to the other to minimize the gap between the largest and smallest of the a+b pieces, and print that gap as an irreducible fraction.
Level

Medium6 of 10

Topics
Math, Number theory, Implementation, Brute force
Solved
No attempts yet

Problem

Petya and his friends want to celebrate his birthday party. Petya has a round cake for the occasion. The only thing left is to divide it, and they will have tea.

To divide the cake, Petya is going to use slicers. Each slicer has a few blades: a kk-slicer is a device that makes kk straight cuts from the center of the cake to its boundary, and thus divides the round cake into kk identical sectors.

Petya has a red aa-slicer and a blue bb-slicer. Fortunately, there are exactly a+ba + b friends at the party including Petya. So he decided to use each slicer once, so that the cake will be divided into exactly a+ba + b sectors.

After using the two slicers, the resulting a+ba + b sectors may have different sizes. Nevertheless, the cake should be divided as fairly as possible: the difference between the largest sector and the smallest sector should be the minimum possible.

Find the minimum possible difference that Petya can achieve. Find the difference between the areas of the largest and the smallest sectors after the optimal division. Regard the area of the whole cake as 11. Print the resulting area difference as an irreducible fraction.

Input

The first line of input contains two space-separated integers aa and bb: the parameters of the red and blue slicers (2≤a,b≤1002 \le a, b \le 100).

Output

Print an irreducible fraction in the form $a$ / $b$: the difference between the areas of the largest and the smallest of the a+ba + b resulting sectors after the slicers are applied optimally.

Hint

The result of optimal use of the slicers is shown below the examples. The cuts made by the red aa-slicer are shown as pale red thick lines. The cuts made by the blue bb-slicer are shown as blue thin dotted lines.

Examples3

  1. Example 1

    Input
    2 2
    
    Expected output
    0 / 1
    
  2. Example 2

    Input
    2 3
    
    Expected output
    1 / 4
    
  3. Example 3

    Input
    4 2
    
    Expected output
    1 / 8