Under construction

Still being built. Things may change

Spidey Distance

Time limit1sMemory limit1024 MB

Summary
Given taxi-cab distance t and Spidey distance s, output the reduced fraction of lattice points within Spidey distance s that are also within taxi-cab distance t.
Level

Medium5 of 10

Topics
Math, Geometry, Implementation
Solved
No attempts yet

Problem

Consider a 2D plane of points with integer coordinates. The Taxi-cab Distance between two points is the length of the shortest path between them when movement is restricted to horizontal and vertical steps, like following the lines on graph paper. Each point connects to exactly four others, each one unit away.

The Spidey Distance is a similar shortest-path measure, but movement may also go diagonally. Horizontal and vertical neighbors are one unit apart, and diagonal neighbors are 1.51.5 units apart. So each point connects to eight others: four at one unit and four at 1.51.5 units.

Write a program that computes the fraction of points within a given Spidey Distance of a point that can also be reached within a given Taxi-cab Distance of that point.

Input

The single line of input contains two integers tt and ss (0≤t,s≤1060 \le t,s \le 10^6), where tt is a taxi-cab distance and ss is a spidey distance.

Output

Output a fraction in the form nn/dd, the fraction of points within the given spidey distance that can also be reached within the given taxi-cab distance. Reduce the fraction to lowest form. If d=1d=1, output only nn. Do not output any spaces around the /.

Examples4

  1. Example 1

    Input
    4 4
    
    Expected output
    41/49
    
  2. Example 2

    Input
    6 6
    
    Expected output
    17/21
    
  3. Example 3

    Input
    3 7
    
    Expected output
    25/141
    
  4. Example 4

    Input
    7 3
    
    Expected output
    1