#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int t;
double a,b,c,x,ans,d,e;
int main(){
scanf("%d",&t);
while(t--){
scanf("%lf%lf%lf%lf",&a,&b,&c,&x);
ans=sqrt((a*a)+(b+2*c)*(b+2*c));
d=b/100*x;
e=a/100*x;
ans+=sqrt(d*d+e*e);
ans+=sqrt((b-d+2*c)*(b-d+2*c)+(a-e)*(a-e));
printf("%.9f\n",ans);
}
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNzdGRpbz4KI2luY2x1ZGU8Y3N0cmluZz4KI2luY2x1ZGU8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCB0Owpkb3VibGUgYSxiLGMseCxhbnMsZCxlOwppbnQgbWFpbigpewoJc2NhbmYoIiVkIiwmdCk7Cgl3aGlsZSh0LS0pewoJCXNjYW5mKCIlbGYlbGYlbGYlbGYiLCZhLCZiLCZjLCZ4KTsKCQlhbnM9c3FydCgoYSphKSsoYisyKmMpKihiKzIqYykpOwoJCWQ9Yi8xMDAqeDsKCQllPWEvMTAwKng7CgkJYW5zKz1zcXJ0KGQqZCtlKmUpOwoJCWFucys9c3FydCgoYi1kKzIqYykqKGItZCsyKmMpKyhhLWUpKihhLWUpKTsKCQlwcmludGYoIiUuOWZcbiIsYW5zKTsKCX0KCXJldHVybiAwOwp9