https://ac.nowcoder.com/acm/contest/358/B 

题解: 

参考文章:

https://blog.csdn.net/weixin_43272781/article/details/86547839

 https://blog.csdn.net/weixin_43272781/article/details/86547908

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
ll t,n,m,k,q,x,y;
int ans,cnt,flag,temp;
//int a[N];
char str;
ll gcd(ll a,ll b){
    while(b){
        ll r=a%b;
        a=b;
        b=r;
    }
    return a;
}
int main()
{
#ifdef DEBUG
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
    while(~scanf("%lld%lld%lld%lld%lld",&n,&m,&x,&y,&t)){
        ll a=m*x*(x-1)*(m-1)+n*y*(y-1)*(n-1);
        ll b=(x*m+y*n)*(m-1)*(n-1);
        ll gcdab=gcd(b,a);
        a/=gcdab;
        b/=gcdab;
        if(t)
            printf("%lld/%lld\n",a,b);
        else
            printf("%.3f\n",1.0*a/b);
    }
    //scanf("%d",&t);
    //while(t--){}


    //cout << "Hello world!" << endl;
    return 0;
}