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++: // 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 <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-11
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  cout.precision(12);
  while(true){
    double x,h;
    cin>>x>>h;
    if(x==0 && h==0)break;
    double s;
    double po = x*sqrt(2.0)/2.0;
    double bo = sqrt(h*h + po*po);
    double co = x/2.0/bo;
    double si = sqrt(1.0-co*co);
    double ho = si*bo;
    s = ho*x/2.0;
    s *= 4.0;
    s += x*x;
    cout<<fixed<<s<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<math.h>
#include<cstdio>
using namespace std;
int main(void){
	int x,h;
	while(cin>>x>>h){
		double a,b,s;
		if(x==0 && h==0)break;
		a=x*x;
		b=(x*x/4)+(h*h);
		s=a+(sqrt(b)*x/2)*4;
		printf("%lf\n",s);
	}
	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(){
	double x, h;
	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("%.6lf\n",ans);
	}
	return 0;
}

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

using namespace std;

int main(){ 
	double x,h;
	double sum;
	while(true){
		scanf("%lf %lf",&x,&h);
		if(x==0 && h==0){
			break;
		}
		sum=pow(x,2);
		h=sqrt(pow(x/2,2)+pow(h,2));
		sum=sum+2*h*x;
		printf("%0.6lf\n",sum);
	}
}

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

using namespace std;

int main(void){
  double x,h;
  while(cin >> x >> h,x&&h)
    printf("%.6f\n",x*x + sqrt((x*x)/4+h*h) *x *2);

  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
    int x, h;
    while (scanf("%d%d", &x, &h), (x || h)) {
        double S = x * sqrt(x * x + 4 * h * h) + x * x;
        printf("%.10f\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 <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	int x, h;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(ifs >> x >> h){
#else
	while(std::cin >> x >> h){
#endif
		if(x == 0 && h == 0){ break; }

		double S = x * x + 2 * x * sqrt(x * x / 4.0 + h * h);

		printf("%.6lf\n", S);

	}


 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}

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

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;


double x,h;

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

C++: #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int p, q; double s;
int main() {
	while (1) {
		cin >> p >> q; s = 0;
		if (!p) { break; }
		s += p*p;
		s += 2.0 * p * sqrt(q*q + (double)(p*p) / 4);
		cout << fixed << setprecision(15) << s << endl;
	}
}