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 <cmath>
#include <cstdio>

using namespace std;

int main(void){

  double x,h;
  while( cin >> x >> h , x || h ){
    double ans = x * sqrt( 4 * h * h + x * x ) + x * x;
    printf("%.6f", ans);
    cout << endl;

  }
  return 0;
}

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

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

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

#define gcu getchar_unlocked
#define ii inline int in
#define is inline bool scan
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
is(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
is(char &c){c=gcu();gcu();return c!=EOF;}
//is(string &s){int c; s = "";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
//void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

int main() {
	for (int x, h; x = in(), h = in(), x || h;)
		printf("%lf\n", (x + sqrt(x * x + 4 * h * h)) * x);
}

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

using namespace std;

int main(){

	double x,h;
	double s;
	double skseki;

	while(1){

		cin >> x >> h;

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

		double tei = x * x;
		double skmnh = sqrt((x/2 * x/2) + (h * h));
		
		skseki = (skmnh * x / 2) * 4;
		s = skseki + x * x;

		printf("%6f\n", s);
	}

	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  double x, h;
  double y, T, S;

  while(1) {
    S = 0;
    cin >> x >> h;
    if(x+h == 0)break;

    y = sqrt((x/2)*(x/2) + h*h);
    T = x * y / 2;
    S = T*4 + x*x;

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