#include <bits/stdc++.h>
using namespace std;
bool inRange(int x, int min, int max){
return min <= x && x <= max;
}
int main() {
int a, b, c, d;
cin >> a >> b >> c >> d;
int n;
cin >> n;
while(n--){
int x;
cin >> x;
long long res = 0;
for (int i = 1; i*i <= x; i++){
if (x % i != 0){
continue;
}
int x1 = i;
int x2 = x / i;
if (inRange(x1, a, b) && inRange(x2, c, d)){
res++;
}
if (x1 != x2){
if (inRange(x1, c, d) && inRange(x2, a, b)){
res++;
}
}
}
long long p = res;
long long q = (b - a + 1) * (long long)(d - c + 1);
cout << p << "/" << q << endl;
}
}