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 <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<cstdio>
#include<cmath>
using namespace std;
#define int long long
signed main(){
	while(true){
		double x,h;
		scanf("%lf",&x);
		scanf("%lf",&h);
		if(x==0&&h==0) break;
		double s = sqrt(h*h+x*x/4.0);
		printf("%f\n",x*x+x*s*2.0);
	}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main()
{
	int x,h;
	while(1)
	{
		cin >> x >> h;
		if(x==0&&h==0)break;
		double t;
		t = sqrt((((double)x)/2.0)*(((double)x)/2.0)+(double)(h*h));
		double ans=0.0;
		ans += x*x;
		ans += double(x)*t*2;
		printf("%.6f\n",ans);
	}
	return 0;
}

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

int main(){
	int x,h;
	double S;
	while(cin >> x >> h){
		if(x == 0 && h == 0) return 0;
		S = (double)( x*x + (sqrt(x*x+4*h*h) * x) );
		printf("%f\n",S);
	}
}

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

int main() {
  double x,h;
  while(true) {
    cin>>x>>h;
    if(!x) break;
    cout.precision(11);
    cout<<showpoint<<x*x+2*x*sqrt(x*x/4+h*h)<<endl;
  }
}

C++: #include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main() {
	vector<double>l;
	double x, h;
	while (cin >> x >> h){
		if (x == 0 && h == 0)break;
		double sqr = x*x;
		double tri = sqrt(x/4*x + h*h)*x / 2;
		l.push_back(sqr + tri * 4);
	}
	for (double i : l) {
		printf("%.6f\n", i);
	}
	char ch;
	cin >> ch;
}

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

int main(){
	while(1){
		double x,h,s;
		cin>>x>>h;
		if(x==0&&h==0)break;
		s=x*x+2*x*pow((x*x/4+h*h),0.5);
		cout<<fixed<<setprecision(6)<<s<<endl;
	}
}

C++: #include<cstdio>
#include<cmath>
using namespace std;
int main(){
	int x,h;
	while(scanf("%d%d",&x,&h),x||h){
		printf("%.5f\n",x*(x+sqrt(x*x/4.+h*h)*2));
	}
	return 0;
}

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

int main() {
	int x,h;
	double S;
	
	while(cin>>x>>h,x|h){
		S = x*x + 2*sqrt(0.25*x*x+h*h)*x;
		printf("%.6lf\n",S);
		
	}
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"


int main() {
	cout << fixed << setprecision(22);
	while (1) {

		ld X, H; cin >> X >> H;
		if (X < eps)break;
		ld a = sqrt(H*H + X*X / 4);
		cout << X*a * 2 + X*X << 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<stdio.h>
#include<math.h>
int main(void)
{
	double x,h,S,y,l;
	while(1){
	scanf("%lf %lf",&x,&h);
	if(x==0 && h==0){
		break;
	}
	y=x*x;
	l=sqrt(h*h+(x/2)*(x/2))*x*2;
	S=y+l;
	printf("%f\n",S);
	}
	return 0;
}