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 <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void){
    int x, h; //正方形の１辺の長さ、四角錐の高さ

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

        double S, s1, s2; //四角錐の表面積、底面の面積、三角形の面積

        s1 = x * x;
        s2 = x * sqrt(pow(0.5 * x, 2) + pow(h, 2)) * 0.5;
        S = s1 + s2 * 4;

        cout << fixed << setprecision(6) << S << endl;
    }
}

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

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

C++: #include<iostream>
using nmespace std;
int main(){
int w,h;
float ans;
while(1){
cin>>w>>h;
if(w==0&&h==0){
break;
}
ans=(float)w*w*2.0+w*h*6.0;
cout<<ans<<endl;
}

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

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

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

using namespace std;

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

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

using namespace std;

void solve()
{
	int x, h;
	while(cin >> x >> h)
	{
		if(x == 0 && h == 0)
		{
			break;
		}
		double surfaceArea = x * x;
		surfaceArea += 2 * (sqrt((x / 2.0) * (x / 2.0) + h * h) * x);
		printf("%.6f\n", surfaceArea);
	}
}

int main()
{
	solve();
	return(0);
}

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

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

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

using namespace std;

int main()
{
    double a, b;
    while (cin >> a >> b, a || b) {
        printf("%.9lf\n", a*a + a*2*sqrt((a*a)/4+b*b));
    }

    return 0;
}

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

using namespace std;

int main()
{
    double x, h;
    cout << setprecision(6) << setiosflags(ios::fixed);
    while (cin >> x >> h, x || h) {
        cout << (x * x + 2 * sqrt(h * h + x * x / 4) * 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++: //
//  main.cpp
//  kyougi
//
//  Created by 寺林 一旭 on 2018/08/27.
//  Copyright © 2018年 寺林 一旭. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <complex>
using namespace std;
int main() {
    
    float num;
    
    vector<int> list;
  
    float teimen = 0;
    float takasa = 0;
    int cnt = 0;
    while(cin >> num) //getline(cin, num))
    {
        if ( cnt == 2)
        {
            cnt =0;
        }
        if ( cnt == 0)
        {
            teimen = num;
        }
        if( cnt == 1)
        {
            takasa = num;
          
            float seihou = teimen* teimen;
            float teimenhalf = teimen/2.f;
            float sanhei = sqrt((takasa*takasa) - (teimenhalf*teimenhalf));
            float sankaku = (teimen * sanhei) /2.f * sanhei;
            
            
        
            cout <<seihou + sankaku<< endl;

            
        }
        
        
        cnt ++;
    }
  
    
    return 0;
}

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

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

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

int main(){
	int x,h;
	double ans;

	while(scanf("%d\n%d", &x, &h)){
		if(x==0 && h==0) break;
		ans = 0;
		ans += (double)x*x;
		double ah = sqrt(x/2.0*x/2.0+h*h);
		ans += (ah*x)/2.0*4.0;
		printf("%f\n", ans);
	}

	return 0;
}

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

int main(){
	int x,h;
	while (cin>>x>>h,x!=0||h!=0) cout<<fixed<<setprecision(6)<<x*x+2*x*sqrt(x*x*.25+h*h)<<endl;
}