A. Die Roll

A. Die Roll
time limit per test
1 second
memory limit per test
64 megabytes
input
standard input
output
standard output

Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thought about Tasmania, its beaches, sun and sea. Dot chose Transylvania as the most mysterious and unpredictable place.

But to their great regret, the leave turned to be very short, so it will be enough to visit one of the three above named places. That's why Yakko, as the cleverest, came up with a truly genius idea: let each of the three roll an ordinary six-sided die, and the one with the highest amount of points will be the winner, and will take the other two to the place of his/her dreams.

Yakko thrown a die and got Y points, Wakko — W points. It was Dot's turn. But she didn't hurry. Dot wanted to know for sure what were her chances to visit Transylvania.

It is known that Yakko and Wakko are true gentlemen, that's why if they have the same amount of points with Dot, they will let Dot win.

Input

The only line of the input file contains two natural numbers Y and W — the results of Yakko's and Wakko's die rolls.

Output

Output the required probability in the form of irreducible fraction in format ?A/B?, where A — the numerator, and B — the denominator. If the required probability equals to zero, output ?0/1?. If the required probability equals to 1, output ?1/1?.

Sample test(s)
input
4 2
output
1/2
Note

Dot will go to Transylvania, if she is lucky to roll 4, 5 or 6 points.

三个人掷骰子,求概率

/* ***********************************************
Author :
Created Time :2015/6/2 16:01:09
File Name :2.cpp
************************************************ */

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#define ull unsigned long long
#define ll long long
#define mod 90001
#define INF 1<<30
#define maxn 10000+10
#define cle(a) memset(a,0,sizeof(a))
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;

bool cmp(int a,int b){
return a>b;
}
int gcd(int a,int b){
return a==0?b:gcd(b%a,a);
}
int main()
{
#ifndef ONLINE_JUDGE
//freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
int y,w;
while(cin>>y>>w){
int k=max(y,w);
int t=6-k+1;
int x=gcd(t,6);
printf
("%d/%d\n",t/x,6/x);
}
return 0;
}



你可能感兴趣的:(A. Die Roll)