This page is still under construction.

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

Commemorative Dice

Interview

Time limit0.5sMemory limit512 MB

Summary
Given two six-sided dice whose faces sum to 21, count the pairs where the first player's roll beats the second's and print the winning probability as a reduced fraction.
Level

Easy2 of 10

Topics
Brute force, Math, Implementation
Solved
No attempts yet

Problem

An ICPC regional contest has been held in Korea every year since 2000. To commemorate the 21st regional contest this year, a dice will be made. The commemorative dice is a regular cube with a positive integer on each face, like an ordinary dice, but the six numbers do not have to be 1, 2, 3, 4, 5, 6; only their sum must be 21.

The dice can be used in various ways. For example, two people can play a game as follows. Each picks one of the many dice, and then they roll their dice. The one who rolls the larger number wins. Which dice to pick matters in this game, because once the dice are set, the probability that one beats the other is fixed. Suppose KyungYong picks the dice in the left figure below and TaeCheon picks the dice in the right figure below. Then KyungYong wins exactly when TaeCheon rolls 1, so the probability that KyungYong wins is 2/3.

Given the dice of the first and second players, write a program that computes the probability that the first player wins.

Input

Your program reads from standard input. The input consists of two lines. The first line contains six positive integers written on the faces of the first player's dice. The second line contains six positive integers written on the faces of the second player's dice. The six integers on a line sum to 21 and are separated by a single space.

Output

Your program writes to standard output. Print exactly one line containing the irreducible fraction that represents the probability that the first player wins. The fraction must have a numerator before a slash and a nonzero denominator after the slash. There are no spaces before or after the slash. An irreducible fraction is a fraction whose numerator and denominator are integers with no common divisor other than 1.

Examples3

  1. Example 1

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

    Input
    1 2 3 4 5 6
    3 4 3 4 3 4
    
    Expected output
    5/12
    
  3. Example 3

    Input
    1 2 3 4 5 6
    8 7 2 2 1 1
    
    Expected output
    1/2