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 <string>
#include <algorithm>
#include <cstdio>
#include <math.h>
using namespace std;

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

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

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

C++: #include<iostream>
using namespace 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 <math.h>
using namespace std;

int main()
{
	double x,h;
	while(cin >> x >> h && x && h)
	{
		double sum = 0;
		sum += x*x;
		double half = x /2;
		sum += 2*x*sqrt(half*half+h*h);

		cout << fixed;
		cout.precision(6);
		cout << sum << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main()
{
	double x, h;
	while (true){
		cin >> x >> h;
		if (x == 0 && h == 0){
			break;
		}
		double ans = x*sqrt(4 * h*h + x*x) + x*x;
		printf("%lf\n", ans);
	}
}

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

using namespace std;

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

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

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

	while(cin >> x >> h, x || h){
		l = sqrt(pow(x/2, 2)+pow(h, 2));

		ans = x*l*2 + pow(x, 2);

		printf("%f\n", ans);

	}
}

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

int main(){
	double x, h, ans;
	while (cin >> x >> h) {
		if (x == 0 && h == 0) { break; }
		x *= 10000;
		h *= 10000;
		ans = pow(x, 2) + 2 * x * sqrt(pow(h,2)+pow(x/2,2));
		cout << fixed << setprecision(6) << ans / 100000000 << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	double a;
	while(cin >> a,a){
		double x,h; cin >> h;
		x=a;
		double ans=x*x+2*x*sqrt(x/2*x/2+h*h);
		printf("%.8f\n",ans);
	}
}

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;

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

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
	double x,h;
	while(true){
	scanf("%lf%lf",&x,&h);if(x==0&&h==0)break;
	double ans=x*x+2*x*sqrt((x/2)*(x/2)+h*h);
	printf("%.50lf\n",ans);
	}

	return 0;
}

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

using namespace std;

double surfaceArea(double x, double h)
{
  return x*x + x*sqrt(4*h*h+x*x);
}

int main()
{
  int x, h;

  while(cin>>x>>h && x != 0 && h != 0){
    printf("%.6lf\n", surfaceArea((double)x, (double)h));
  }

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
 
int main(){
    double x, h;
    while(cin >> x >> h, x != 0 || h != 0){
    printf("%.9lf\n", x * x + 2 * x * hypot(x / 2, h));
    }
    return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	double x,h;
	for(;x=in(),h=in();){
		printf("%.10f\n",x*x+2*x*sqrt(h*h+x*x/4));
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
using namespace std;
int main(){
	
	int x,h;
	double t,s;
	while(cin>>x>>h){
		if(x!=h!=0){
			t=sqrt(pow((double)x/2,2)+pow(h,2));
			s=pow(x,2)+(double)(x*t)*2;
		
		printf("%.6f\n",s);
		}
		else
			break;
	}
	
}

C++: #include<bits/stdc++.h>
using namespace std;
double x,y;
bool input(){
cin>>x>>y;
return (x!=0)||(y!=0);
}
double solve(){
double tmp = sqrt((x/2)*(x/2)+y*y);
return (x*x) + 4* x*tmp/2;
}
int main(){
while(input()){
cout<<setprecision(100)<<solve()<<endl;
}
}

C++: #include<bits//stdc++.h>
using namespace std;
int main(){
  double x,h;
  while(cin >> x>> h,x,h){
      double hh = sqrt(x*x/4+h*h);
      cout << fixed << setprecision(10)<<x*x + x*hh*2<<endl;
  }
}

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

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