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 <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <tuple>
#include <set>
#include <functional> 
#include <string.h>
//#include <assert.h>
//#include <typeinfo.h>
#include <time.h>

#define X first
#define Y second
#define MP make_pair
#define MT make_tuple
#define FOR(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REP(i, a, n) for(int (i) = (a); (i) < (n); ++(i))
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll > pll;
using namespace std;

const int INIT_SIZE_MAX = (1 << 29) + 10;
const int INIT_SIZE_MIN = -(1 << 29) - 10;
const int INIT_SIZE = 0;
const int MAX = 8;
const int DIR_SIZE = 12;
const double PI = 3.1415926535897932384;

template<class T, class U>
void convert(T &t, U &u){
	stringstream ss;
	ss << t;
	ss >> u;
}

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

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int x,h;
int main(){
	while(cin>>x>>h,x||h){
		printf("%.7f\n",x*x+sqrt(x*x*0.25+h*h)*4*x*0.5);
	}
	return 0;
}

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

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<math.h>

using namespace std;

int main()
{	
	double x,h;
	double ans,height;
	while(cin>>x>>h,x!=0){
		height=sqrt(h*h+x*x/4);
		ans=0;
		ans+=x*x+height*x*2;
		printf("%.6lf",ans);
	}
	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 <cstdio>
#include <math.h>
using namespace std;

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

     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)
			break;
		S=x*(x+2*sqrt((double)(x*x/4+h*h)));
		printf("%.6f\n", S);
	}

	return 0;

}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int x, h;
        cin >> x >> h;
        if(x == 0)
            return 0;

        double y = sqrt(h*h + x*x/4.0);
        double s = x * x + (x * y) * 2;
        printf("%.10f\n", s);
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>

using namespace std;


int main(void)
{
    while(1){
        int x,h;
        cin>>x>>h;
        if(x==0&&h==0)break;
        double h2,x2;
        x2=(double)x;
        h2=sqrt(((double)x/2.0)*((double)x/2.0)+((double)h)*((double)h));
        cout<<fixed<<setprecision(6)<<x2*h2*2.0+x2*x2<<endl;
    }
    
}

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

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

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

using namespace std;

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

    return 0;
}

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

double getHypotenuse( double a , double b )
{
	return sqrt( pow( (double)a , 2 ) + pow( (double)b , 2 ) );
}

int main(void)
{
	int x, h;

	while(1){
		std::cin >> x >> h;
		if( x == 0 && h == 0 ){
			break;
		}
		std::cout.precision(9);
		std::cout << (double)x * (double)x + 2.0 * x * getHypotenuse( (double)x/2.0 , (double)h ) << std::endl;
	}

	return 0;
}

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

int main(void){
	int x,h;
	double s,t_h;
	while(0==0){
		scanf("%d",&x);
		scanf("%d",&h);
		if(x==0 && h==0)break;
		t_h=sqrt(h*h+((double)x*(double)x)/4);
		s=(double)x*(double)x+(double)x*t_h*2.0;
		printf("%f\n",s);
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>

//AOJ0073
#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;

int main(void){

int x,h;
char k;
	while(cin >> x >> h){
		if(x==0 && h==0 || cin.eof()) break;
		double trg = sqrt(x*x/4.00 + 1.00*h*h) * x * 0.5;
		
		printf("%.8f\n",trg*4+x*x*1.00);
	}
	return 0;
	
}

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

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