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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	while ( true )
	{
		int x, h;
		cin >> x >> h;

		if ( x == 0 && h == 0 )
		{
			break;
		}

		double area = x * x;
		area += 2 * sqrt( pow( x / 2.0, 2 ) + pow( h, 2 ) ) * x;

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

	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.pym", "r", stdin);
	string str = "";
	int n;
	int count = 0;
	int x, h;

	while (getline (cin, str ) ){
		stringstream ss(str);
		ss >> n;

		if (count % 2 == 0 ){
			x = n;
			++count;
			continue;
		} // end if

		if (count % 2 != 0 ){
			h = n;
			++count;		
		} // end if
		
		if (x == 0 && h == 0){
			break;
		}else{
			//cout << "x: " << x << " h: " << h << endl;
			if (x == 0 || h == 0){
				cout << '0' << endl;
			}else{
				double m = (double)x/2.*(double)x/2.;
					m += (double)(h*h);
				double s  = sqrt (m);
				double res = x*(x+2*s);
				printf ("%.9f\n", res );
			} // end if
		} // end if
	} // end loop

		
	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;



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

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

double x, h;

int main()
{
  while(~scanf(" %lf %lf", &x, &h) && x && h){
    printf("%.15f\n", x * x + 4 * x * sqrt(h * h + x * x / 4.0) / 2.0);
  }

  return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<sstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<numeric>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;
typedef map<string,int> dict;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
double eps = 1e-10 ;

template <typename T>
void out(vector < T > v)
{
  for(size_t i = 0; i < v.size(); i++)
  {
    debug(v[i]);
  }
}

template<typename T>
string ntos( T i ) {
  ostringstream s ;
  s << i ;
  return s.str() ;
}

template<typename T>
T ston(string str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double x,h;
  while(1){
    cin >> x >> h;
    if(x + h == 0){
      break ;
    }
    cout << fixed << setprecision(6) << x * x + 2 * x * sqrt((x/2)*(x/2) + h* h) << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
	for(;;){
		int x;
		int h;
		double S = 0;
		
		cin >> x >> h;
		
		if(x == 0 && h == 0){
			break;
		}
		
		S += x*x;
		
		cout << S << endl;
		S += x*(double)sqrt((x*(double)x/4)+(h*h))*2;
		
		printf("%lf\n",S);
	}
}

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

int main(){
  int x,h,i,j;
  double S;
  while(1){
    cin >> x >> h;
    if(x ==0 && h == 0)break;
    S=(x * x)+sqrt( ((x*0.5) * (x*0.5)) + (h*h) ) * x * 0.5 * 4;
    printf("%.6lf\n",S);
  }
  return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    double x , h;

    while(scanf("%lf%lf",&x,&h),x,h){
        double ans = 0;
        ans += x*x;

        double y;
        y = x/2;

        double a;
        a = hypot(y,h);

        ans += x*a*2;
        printf("%lf\n",ans);
    }

    return 0;
}

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

using namespace std;

int main()
{
	int x, h;
	double x2 = 2.0;
	double X, H;
	double S;
	
	while (1){
		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;
		
		cout << S << endl;
	}
}

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

using namespace std;
int main(){
    double x,h,high,ans;
    while(cin>>x>>h){
        if(x==0)break;
        ans=(x/2)*(x/2)+h*h;
        high=sqrt(ans);
        ans=(x*x)+(4*(x*high/2));
        printf("%lf\n",ans);
    }
    return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
using namespace std;

int main(){
double a,b;
while(1){
	cin>>a>>b;
	if(a==0&&b==0)break;
	printf("%.7f\n",a*a+sqrt((a/2.0)*(a/2.0)+b*b)*a/2.0*4.0);
}
}

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

int main(){
  double x, h, s;
  while(1){
    scanf("%lf%lf", &x, &h);
    if(!x && !h) break;
    printf("%.6f\n", (x * x) + 2 * x * sqrt((x / 2) * (x / 2) + h * h));
  }
  return 0;
}

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

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

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

# define REP(i,n) for(int i=0; i<n;i++)

using namespace std;

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