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<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


double X = 0;
double H = 0;

void input(void) {
	CI X;
	CI H;

	return;
}


int main(void) {
	while (1) {
		input();
		if (X == 0 && H == 0) {
			return 0;
		}
		printf("%.6f", X * X + 2 * X * sqrt(H * H + X * X / 4.0));
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(void){
	while(1){
		int x,h;
		double th;

		cin >> x >> h;
		if( x==0 && h==0 ) break;

		th=sqrt(double(x*x/4.0+h*h));
		printf("%.8f\n",x*x+2*x*th);
	}
	return 0;
}

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

using namespace std;

int main()
{
	int x, h;
	double x2;
	double X, H;
	double S;
	
	while (1){
		x = 0;
		h = 0;
		x2 = 2.0;
		
		cin >> x >> h;
		
		if (x == 0 && h == 0){
			break;
		}
		
		X = x * x;
		x2 = x / x2;
		H = sqrt(x2 * x2 + h * h);
		
//		cout << X << " " << x2 << " " << H << endl;
		
		S = X + (H * x2) * 4;
		
		printf("%f\n", S);
	}
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



int x, h;


int main() {
    while (cin >> x >> h) {
        if (x == 0 && h == 0) break;
        double dx = x; double dh = h;
        
        cout << fixed << setprecision(9) << dx*dx + dx*sqrt(dx*dx+dh*dh*4) << endl;
    }
    
    return 0;
}

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

using namespace std;

template <class Type>
Type dist(Type x, Type y)
{
	return sqrt(pow(x, 2) + pow(y, 2));
}

int main()
{
	const int DATASETS = 1000;

	double V[DATASETS];

	int X, H, K = 0;

	double A, B;

	while (true)
	{
		cin >> X >> H;

		if (X == 0 && H == 0) { goto Exit; }

		A = X;
		B = dist<double>(static_cast<double>(X) / 2, static_cast<double>(H));

		V[K] = static_cast<double>(X * X) + A * B * 2;

		K++;
	}

Exit:;

	for (int i = 0; i < K; i++)
	{
		cout << fixed << setprecision(15) << V[i] << endl;
	}

	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 <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

D EPS = 1e-6;

int main() {
	int X, H;
	
	while (1) {
		cin >> X >> H; if (X==0 && H==0) break;
		
		D x = (D)X, h = (D)H;
		D y = sqrt((x/2.0)*(x/2.0) + h*h);
		D ans = (y*x/2.0)*4.0 + x*x;
		
		ans -= EPS;
		printf("%lf\n", ans);
	}
	
	return 0;
}

C++: 

/*
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;

int main(){

double x,h,W=0,X=0,S=0;
while(1){
scanf("%lf %lf",&x,&h);
if(x==0&&h==0)break;
X=0.5*x;
W=sqrt(X*X+h*h);
S=x*x+2*W*x;
cout<<S<<endl;

}
return 0;
}

*/

#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;

int main(){

double x,h,W,S=0,R=0,PI;
PI=3.141592;
while(1){
scanf("%lf %lf",&x,&h);
if(x==0&&h==0)break;
R=atan2( h, 0.5*x );
W=0.5*x/cos(R);
//W=sqrt(x*x+h*h);
S=x*x+2*W*x;
printf("%lf\n",S);
//cout<<S<<endl;
//cout<<W<<endl;

}
return 0;
}

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

using namespace std;

int main(void){

	double x,h;
	
	while(1){
		cin>>x;
		cin>>h;
		if(x==0&&h==0) break;
		printf("%.6f\n",2*x*(sqrt(pow(h,2)+pow(x,2)/4))+pow(x,2));
	}
	return 0;
}