Go: package main

import (
	"fmt"
	"math"
)

func main() {
	x := -1
	h := -1
	for {
		fmt.Scan(&x)
		fmt.Scan(&h)
		if x == 0 && h == 0 {
			return
		}

		f_x := float64(x) / 2.0

		sya := math.Sqrt(f_x*f_x + float64(h*h))
		fmt.Println(float64(x*x) + float64(x)*sya*2.0)

	}
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	int x,h;
	double s;
	for(;;){
		scanf("%d%d",&x,&h);
		if(!x&&!h)break;
		s=x*x;
		s+=2*x*sqrt(x*x/4.0+h*h);
		printf("%f\n",s);
	}
	return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  double x, h;
  while (cin >> x >> h, x) {
    cout << prec(8) << x * x + x * hypot(h, x / 2) * 2 << endl;
  }
}

C++: 
#include <iostream>
#include<string>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    double x,s,h;
    while(cin>>x>>h){
        if(x==0&&h==0)break;
        s=x*x+x*sqrt(x*x+4*h*h);
       printf("%.6f",s);
        cout<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
  int x, h;
	double a;
	while (cin >> x >> h, x, h){
		a = sqrt((x / 2.0) * (x / 2.0) + h * h);
		printf("%l.6f\n", x * x + a * x * 2);
	}
	return (0);
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <vector>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

using namespace std;

int main(){
	long double x, h;
	long double ans;
	while (cin >> x >> h) {
		
		
		if (x == 0 && h == 0) {
			break;
		}
		ans = x * x + x * sqrt(h*h + (x / 2)*(x / 2)) * 2;
		printf("%lf",ans);
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
	while(1){
		double x,h,S;
		cin >> x;
		cin >> h;
		if(!x&&!h)	break;
		S = x*x;
		S += (sqrt(x*x/4+h*h)*x*2);
		printf("%.7lf\n",S);
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(void)
{
	double x,h,c;
	while(1){
		scanf("%lf %lf",&x,&h);
		if(x == 0.0 && h == 0.0) break;
		c = (x/2.0)*(x/2.0) + h*h;
		c = sqrt(c);
		c = x*x + x*c/2.0*4.0;
		printf("%lf\n",c);
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );
	cout << setprecision( 8 ) << fixed;

	for ( int x, h; cin >> x >> h, x | h; )
	{
		const double naname = sqrt( pow( x / 2., 2. ) + pow( 1. * h, 2. ) );
		const double res = x * x + ( naname * x ) * 2;
		cout << res << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
	int a,b;
	while(cin >> a >> b){
		if(a==0 && b==0)
			break;
		double x = static_cast<double>(a);
		double h = static_cast<double>(b);
		cout << setprecision(6) << fixed << x*x+2*x*sqrt(x*x/4+h*h) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

double x,h;

int main(){
	while(cin>>x>>h){
		if(!x)return 0;
		printf("%.6f\n",x*x+2.0*x*sqrt(x*x/4.0+h*h));
	}
}

C++: #include <iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main(void){
    int x, h;
  
    while(true){
        cin >> x >> h;
        if(x == 0 && h == 0) break;
  
        double S, s1, s2;
        s1 = x * x;
        s2 = x * sqrt(pow(0.5 * x, 2) + pow(h, 2)) * 0.5;
        S = s1 + s2 * 4;
  
        cout << fixed << setprecision(6) << S << endl;
    }
}

C++: #include <stdio.h>
#include<math.h>
#include <string.h>
#include <ctype.h>

int main(){
double x,h,c,a;
while(1){
scanf("%lf%lf",&x,&h);
if(x==0&&h==0)break;
c=4*h*h+x*x;
c=sqrt(c);
a=x*c+x*x;
printf("%f\n",a);
}
return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main() {
	
	double x, h;
	double ans;
	
	while(cin >> x >> h) {
		
		ans = 0;
		
		if( x == h && h == 0)
			break;
			
		ans = x * x + sqrt( (x / 2) * (x / 2) + h * h) * x * 2;
			
		cout << fixed << setprecision(6) << ans << "\n";
		
	}
	
	return 0;
}

C++: #include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

int main(){

	double x,h;

	while(true){
		scanf("%lf",&x);
		scanf("%lf",&h);
		if(x == 0 && h == 0)break;

		printf("%.6lf\n",x*x+2*x*sqrt(h*h+(x/2)*(x/2)));
	}

    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main() {
    double x, h;
    while (1) {
        cin >> x; cin >> h;
        if (x == 0 && h == 0) {
            break;
        }
        cout.precision(10);
        cout << x * x + sqrt((x/2)*(x/2) + h*h) * x * 2 << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cmath>
using namespace std;

#define sq(a) (a*a)

int main() {
  
  double x, h;

  while(scanf("%lf\n%lf", &x, &h) == 2 && x+h) {
    printf("%.6lf\n", sq(x)+ x * ( sqrt(sq(x/2)+sq(h)) ) * 2 );
  }
  
  return 0;
}