#include<bits/stdc++.h> using namespace std; int t1,t2,s1,s2,w; int get(int b) { int s=(s2-s1)*(t2-t1)*2; int d=s2-s1; int y=s2-b; if(y<=t1) return 0; if(y<=t1+d) return (y-t1)*(y-t1); if(y<=t2) return d*(y-t1+y-t1-d); if(y<=t2+d) return s-(t2+d-y)*(t2+d-y); return s; } int main() { int T; scanf("%d",&T); for(int i=1;i<=T;i++) { scanf("%d %d %d %d %d",&t1,&t2,&s1,&s2,&w); if(t2-t1<s2-s1) { swap(t1,s1); swap(t2,s2); } int area=get(-w); int num=get(w); area-=num; int s=(s2-s1)*(t2-t1)*2; printf("Case #%d: %.8f ",i,area*1.0/s); } }