#include<iostream>
#include<set>
#include<math.h>
using namespace std;
int  in[1005];
int  out[1005];
int  n;
int  w;
//#define int double
bool cmp(double anss) {
	double ans = anss + w;
	//带了这么多的燃料..
	//cout << "------";
	//cout << ans << endl;

	double  temp = 0;
	for (int   i = 1; i <n; i++) {
		temp = ans / out[i]*1.0;
		ans = ans - temp;
		//cout << "out" << ans << endl;
		temp = ans / in[i + 1]*1.0;
		ans = ans - temp;
	//	cout << "in" << ans << endl;
		if (ans < w)return false;
	}int  nn = n;
	temp = ans / out[nn] * 1.0;
	ans = ans - temp;
	//cout << "out" << ans << endl;
	temp = ans / in[1] * 1.0;
	ans = ans - temp;
	//cout << "in" << ans << endl;
	if (ans < w)return false;
	return true;
}
int main() {
	cin >> n >> w;
	int flag = true;
	for (int i = 1; i <= n; i++) {
		cin >> out[i];//[i]0.0000001;
		if (out[i] == 1)flag = false;
	}
	for (int i = 1; i <= n; i++) {
		cin >> in[i]; //out[i] += 0.0000001;
		if (in[i] == 1)flag = false;
	}
	if (flag == false) { cout << "-1" << endl; return 0; }
	double l = 1.0; double r = 1000000004;
	double   ans = 0;
	double mid;
	if (cmp(r)==false) { cout << "-1" << endl; return 0; }
	while (r - l >= 0.000001)
	{
		mid = (l + r) / 2.0;
		if (cmp(mid))
		{
			r = mid;
		}
		else l = mid;
	}
	cout << r<< endl;
	//是不是如果不是读进来的话 就不会有误差
	return 0;
}


#include<iostream>
#include<set>
#include<math.h>
using namespace std;
int  in[1005];
int  out[1005];
int  n;
int  w;
//#define int double
bool cmp(double anss) {
	double ans = anss + w;
	//带了这么多的燃料..
	//cout << "------";
	//cout << ans << endl;

	double  temp = 0;
	for (int   i = 1; i <n; i++) {
		temp = ans / out[i]*1.0;
		ans = ans - temp;
		//cout << "out" << ans << endl;
		temp = ans / in[i + 1]*1.0;
		ans = ans - temp;
	//	cout << "in" << ans << endl;
		if (ans < w)return false;
	}int  nn = n;
	temp = ans / out[nn] * 1.0;
	ans = ans - temp;
	//cout << "out" << ans << endl;
	temp = ans / in[1] * 1.0;
	ans = ans - temp;
	//cout << "in" << ans << endl;
	if (ans < w)return false;
	return true;
}
int main() {
	cin >> n >> w;
	int flag = true;
	for (int i = 1; i <= n; i++) {
		cin >> out[i];//[i]0.0000001;
		if (out[i] == 1)flag = false;
	}
	for (int i = 1; i <= n; i++) {
		cin >> in[i]; //out[i] += 0.0000001;
		if (in[i] == 1)flag = false;
	}
	if (flag == false) { cout << "-1" << endl; return 0; }
	double l = 1.0; double r = 1000000005;
	double   ans = 0;
	double mid;
	while (r - l >= 0.000001)
	{
		mid = (l + r) / 2.0;
		if (cmp(mid))
		{
			r = mid;

		}
		else l = mid;
	}
	/*
	while (r - l >= 0.001) {
		double   mid = (l + r) / 2.0;
		if (cmp(mid) == true)
		{r = mid - 1;	ans = mid;}
		else l = mid + 1.0;
		cout << mid << endl;
	}*/
	cout << r<< endl;
	//是不是如果不是读进来的话 就不会有误差
	return 0;
}


#include<iostream>
#include<set>
#include<cmath>
using namespace std;
double  in[1005];
double  out[1005];
int n;
double  w;
//#define int double
bool cmp(double anss) {
	double ans = anss + w;
	//带了这么多的燃料..
	double  temp = 0;
	for (int i = 1; i < n; i++) {
		temp = ans / out[i] * 1.0;
		ans = ans - temp;
		//cout << "out" << ans << endl;
		temp = ans / in[i + 1] * 1.0;
		ans = ans - temp;
		//	cout << "in" << ans << endl;
		if (ans <= w)return false;
	}
	temp = ans / out[n] * 1.0;
	ans = ans - temp;
	//cout << "out" << ans << endl;
	temp = ans / in[1] * 1.0;
	ans = ans - temp;
	//cout << "in" << ans << endl;
	if (ans <= w)return false;
	return true;
}
int main() {
	cin >> n >> w;
	int flag = true;
	for (int i = 1; i <= n; i++) {
		cin >> out[i];//[i]0.0000001;
		if (out[i] == 1)flag = false;
	}
	for (int i = 1; i <= n; i++) {
		cin >> in[i]; //out[i] += 0.0000001;
		if (in[i] == 1)flag = false;
	}
	if (flag == false) { cout << "-1" << endl; return 0; }
	double l = 1.0; double r = 1e9+4;
	double   ans = 0;
	double mid;
	if (cmp(r)==false) { cout << "-1" << endl; return 0; }
	for(int i=1;i<=100;i++)
	{
		mid = (l + r) / 2.0;
		if (cmp(mid))
		{
			r = mid;
		}
		else l = mid;
	}
	printf("%.12f", r);
	//是不是如果不是读进来的话 就不会有误差
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>
#include<stack>
#include<utility>

#define MUL 100000000

using namespace std;

typedef long long ll;

int food[123];

int main() {
	ll n, m, tmp;
	cin >> n >> m;
	m *= MUL;
	vector<ll> seq[2];
	seq[0].resize(n);
	seq[1].resize(n);
	for (int i = 0; i < 2; ++i) {
		for (int j = 0; j < n; ++j)
			cin >> seq[i][j];
	}
	vector<ll> f;
	f.push_back(seq[1][0]);
	for (int i = n - 1; i >= 0; --i) {
		f.push_back(seq[0][i]);
		f.push_back(seq[1][i]);
		if (seq[0][i] == 1 || seq[1][i] == 1) {
			printf("-1");
			return 0;
		}
	}
	f.pop_back();

	ll ans = 0;
	for (int i = 0; i < 2 * n; ++i) {
			tmp = (m + ans) / (f[i] - 1);
			ans += tmp;
	}
	cout << ans / MUL << '.' << ans % MUL;

}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <iterator>
#include <iostream>
#include <utility>
#include <string>
#include <string.h>
#include <map>
#include <set>
using namespace std;

#define SI(a)  scanf("%i", &(a));
#define SD(a)  scanf("%lf", &(a));
#define SLL(a)  scanf("%I64d", &(a));

#define PI(a)  printf("%i", (a));
#define PD(a)  printf("%lf", (a));
#define PLL(a)  printf("%I64d", (a));

typedef unsigned long long ull;

bool cl(const pair<int, int> &a, const pair<int,int> &b)
{
       return a.first < b.first;
}

#define min(a, b) ( ( (a) < (b) ) ? (a) : (b) )
#define max(a, b) ( ( (a) < (b) ) ? (b) : (a) )

vector<string> split(const string& str, const string& delim)
{
    vector<string> tokens;
    size_t prev = 0, pos = 0;
    do
    {
        pos = str.find(delim, prev);
        if (pos == string::npos) pos = str.length();
        string token = str.substr(prev, pos-prev);
        if (!token.empty())
		  tokens.push_back(token);
        prev = pos + delim.length();
    }
    while (pos < str.length() && prev < str.length());
    return tokens;
}

int gcd ( int a, int b )
{
  int c;
  while ( a != 0 ) {
     c = a; a = b%a;  b = c;
  }
  return b;
}

long long unsigned my_pow(unsigned long long a, unsigned long long b)
{
  long long unsigned result = 1;

  while (b > 0)
  {
    if( b%2 == 1 )
      result *= a;
    a *= a;
    b /= 2;
  }
  return result;
}

bool cmp( pair <int, int>  A, pair <int, int>  B )
{
	return A.first < B.first;
}

int iabs(int x)
{
	if(x >= 0)
		return x;
	return -x;
}

bool in(int l, int r, int x) {return (l <= x && x <= r);}

vector <int> a, b;

bool fly(int m, double X, int n)
{
	double Xn;

	Xn = (m + X)/a[0]; //up from Earth

	if(Xn > X)
	  return false;

	X -= Xn;

    for(int i = 1; i < n; ++i) //for each planet
	{
		Xn = (m + X)/b[i]; //stop

	    if(Xn > X)
	      return false;

		X -= Xn;

		Xn = (m + X)/a[i]; //up

	    if(Xn > X)
	      return false;

		X -= Xn;
	}

	Xn = (m + X)/b[0]; //stop on Earth

	if(Xn > X)
	  return false;

	X -= Xn;
    return true;
}

void task()
{
	double left = 0, right = 1e9+100, X;
	int n, m;

	cin >> n;
	cin >> m;

	a.resize(n);
	b.resize(n);

	for(int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}

	for(int i = 0; i < n; ++i)
	{
		cin >> b[i];
	}

	if(!fly(m, right, n))
	{
		cout << "-1";
		return;
	}

	while(abs(1.0*left - right) >= (double)1e-6)
	{
		X = (left + right)/2;

		if( fly(m, X, n) )
            right = X;
		else
			left = X;
	}

	printf("%10.10lf", X);
}

void main()
{
   task();
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <iterator>
#include <iostream>
#include <utility>
#include <string>
#include <string.h>
#include <map>
#include <set>
using namespace std;

#define SI(a)  scanf("%i", &(a));
#define SD(a)  scanf("%lf", &(a));
#define SLL(a)  scanf("%I64d", &(a));

#define PI(a)  printf("%i", (a));
#define PD(a)  printf("%lf", (a));
#define PLL(a)  printf("%I64d", (a));

typedef unsigned long long ull;

bool cl(const pair<int, int> &a, const pair<int,int> &b)
{
       return a.first < b.first;
}

#define min(a, b) ( ( (a) < (b) ) ? (a) : (b) )
#define max(a, b) ( ( (a) < (b) ) ? (b) : (a) )

vector<string> split(const string& str, const string& delim)
{
    vector<string> tokens;
    size_t prev = 0, pos = 0;
    do
    {
        pos = str.find(delim, prev);
        if (pos == string::npos) pos = str.length();
        string token = str.substr(prev, pos-prev);
        if (!token.empty())
		  tokens.push_back(token);
        prev = pos + delim.length();
    }
    while (pos < str.length() && prev < str.length());
    return tokens;
}

int gcd ( int a, int b )
{
  int c;
  while ( a != 0 ) {
     c = a; a = b%a;  b = c;
  }
  return b;
}

long long unsigned my_pow(unsigned long long a, unsigned long long b)
{
  long long unsigned result = 1;

  while (b > 0)
  {
    if( b%2 == 1 )
      result *= a;
    a *= a;
    b /= 2;
  }
  return result;
}

bool cmp( pair <int, int>  A, pair <int, int>  B )
{
	return A.first < B.first;
}

int iabs(int x)
{
	if(x >= 0)
		return x;
	return -x;
}

bool in(int l, int r, int x) {return (l <= x && x <= r);}

vector <int> a, b;

bool fly(int m, double X, int n)
{
	double Xn;

	Xn = (m + X)/a[0]; //up from Earth

	if(Xn > X)
	  return false;

	X -= Xn;

    for(int i = 1; i < n; ++i) //for each planet
	{
		Xn = (m + X)/b[i]; //stop

	    if(Xn > X)
	      return false;

		X -= Xn;

		Xn = (m + X)/a[i]; //up

	    if(Xn > X)
	      return false;

		X -= Xn;
	}

	Xn = (m + X)/b[0]; //stop on Earth

	if(Xn > X)
	  return false;

	X -= Xn;
    return true;
}

void task()
{
	double left = 0, right = 1e9, X;
	int n, m;

	cin >> n;
	cin >> m;

	a.resize(n);
	b.resize(n);

	for(int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}

	for(int i = 0; i < n; ++i)
	{
		cin >> b[i];
	}

	if(!fly(m, right, n))
	{
		cout << "-1";
		return;
	}

	while(abs(1.0*left - right) >= (double)1e-6)
	{
		X = (left + right)/2;

		if( fly(m, X, n) )
            right = X;
		else
			left = X;
	}

	printf("%10.10lf", X);
}

void main()
{
   task();
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <iterator>
#include <iostream>
#include <utility>
#include <string>
#include <string.h>
#include <map>
#include <set>
using namespace std;

#define SI(a)  scanf("%i", &(a));
#define SD(a)  scanf("%lf", &(a));
#define SLL(a)  scanf("%I64d", &(a));

#define PI(a)  printf("%i", (a));
#define PD(a)  printf("%lf", (a));
#define PLL(a)  printf("%I64d", (a));

typedef unsigned long long ull;

bool cl(const pair<int, int> &a, const pair<int,int> &b)
{
       return a.first < b.first;
}

#define min(a, b) ( ( (a) < (b) ) ? (a) : (b) )
#define max(a, b) ( ( (a) < (b) ) ? (b) : (a) )

vector<string> split(const string& str, const string& delim)
{
    vector<string> tokens;
    size_t prev = 0, pos = 0;
    do
    {
        pos = str.find(delim, prev);
        if (pos == string::npos) pos = str.length();
        string token = str.substr(prev, pos-prev);
        if (!token.empty())
		  tokens.push_back(token);
        prev = pos + delim.length();
    }
    while (pos < str.length() && prev < str.length());
    return tokens;
}

int gcd ( int a, int b )
{
  int c;
  while ( a != 0 ) {
     c = a; a = b%a;  b = c;
  }
  return b;
}

long long unsigned my_pow(unsigned long long a, unsigned long long b)
{
  long long unsigned result = 1;

  while (b > 0)
  {
    if( b%2 == 1 )
      result *= a;
    a *= a;
    b /= 2;
  }
  return result;
}

bool cmp( pair <int, int>  A, pair <int, int>  B )
{
	return A.first < B.first;
}

int iabs(int x)
{
	if(x >= 0)
		return x;
	return -x;
}

bool in(int l, int r, int x) {return (l <= x && x <= r);}

vector <int> a, b;

bool fly(int m, double X, int n)
{
	double Xn;

	Xn = (m + X)/a[0]; //up from Earth

	if(Xn > X)
	  return false;

	X -= Xn;

    for(int i = 1; i < n; ++i) //for each planet
	{
		Xn = (m + X)/b[i]; //stop

	    if(Xn > X)
	      return false;

		X -= Xn;

		Xn = (m + X)/a[i]; //up

	    if(Xn > X)
	      return false;

		X -= Xn;
	}

	Xn = (m + X)/b[0]; //stop on Earth

	if(Xn > X)
	  return false;

	X -= Xn;
    return true;
}

void task()
{
	double left = 0, right = 1e9, X;
	int n, m;

	cin >> n;
	cin >> m;

	a.resize(n);
	b.resize(n);

	for(int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}

	for(int i = 0; i < n; ++i)
	{
		cin >> b[i];
	}

	if(!fly(m, right, n))
	{
		cout << "-1";
		return;
	}

	while(abs(1.0*left - right) >= (double)1e-7)
	{
		X = (left + right)/2;

		if( fly(m, X, n) )
            right = X;
		else
			left = X;
	}

	printf("%10.10lf", X);
}

void main()
{
   task();
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <stdlib.h>
#include <set>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <math.h>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>

using namespace std;

#define ll long long
#define int long long
typedef int hv;
#define double long double
#define make(type, x) type x; cin>>x
#define make2(type, x, y) type x, y; cin>>x>>y
#define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z
#define make4(type, x, y, z, q) type x, y, z, q; cin>>x>>y>>z>>q
#define ALL(x) (x).begin(), (x).end()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define PII pair<int, int>
#define PPII pair<PII, int>
#define M7 1000000007l
#define M9 1000000009l
#define make_v(a, n) VI a(n); FOR(n) cin >> a[i];

VI a;
int m, n;

bool check(double val) {
	for (int i = 0; i < 2 * n; ++i) {
		val -= (m + val) / a[i];
		if (val < 0) return false;
	}
	return true;
}

void Solve() {
	cin >> n >> m;
	a.resize(n << 1);
	FOR(n) cin >> a[i * 2];
	cin >> a[2 * n - 1];
	FOR(n - 1) cin >> a[i * 2 + 1];
	double l = 0.0, r = 1e10l;
	FOR(5000) {
		double mid = (r + l) / 2;
		if (!check(mid)) l = mid;
		else r = mid;
	}
	if (r > 5e9l) cout << -1;
	else cout << fixed << setprecision(12) << l;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	Solve();
	while (!cin.eof()) {
		string s = "_";
		do getline(cin, s);
		while (!cin.eof() && !s.empty());
		if (cin.eof()) return 0;
		FOR(2) cout << endl;
		Solve();
	}
#else
	Solve();
#endif
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <stdlib.h>
#include <set>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <math.h>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>

using namespace std;

#define ll long long
#define int long long
typedef int hv;
#define double long double
#define make(type, x) type x; cin>>x
#define make2(type, x, y) type x, y; cin>>x>>y
#define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z
#define make4(type, x, y, z, q) type x, y, z, q; cin>>x>>y>>z>>q
#define ALL(x) (x).begin(), (x).end()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define PII pair<int, int>
#define PPII pair<PII, int>
#define M7 1000000007l
#define M9 1000000009l
#define make_v(a, n) VI a(n); FOR(n) cin >> a[i];

VI a;
int m, n;

bool check(double val) {
	for (int i = 0; i < 2 * n; ++i) {
		val -= (m + val) / a[i];
		if (val < 1e-13l) return false;
	}
	return true;
}

void Solve() {
	cin >> n >> m;
	a.resize(n << 1);
	FOR(n) cin >> a[i * 2];
	cin >> a[2 * n - 1];
	FOR(n - 1) cin >> a[i * 2 + 1];
	double l = 0.0, r = 1e10l;
	FOR(5000) {
		double mid = (r + l) / 2;
		if (!check(mid)) l = mid;
		else r = mid;
	}
	if (r > 5e9l) cout << -1;
	else cout << fixed << setprecision(12) << l;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	Solve();
	while (!cin.eof()) {
		string s = "_";
		do getline(cin, s);
		while (!cin.eof() && !s.empty());
		if (cin.eof()) return 0;
		FOR(2) cout << endl;
		Solve();
	}
#else
	Solve();
#endif
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <numeric>
#include <cstring>
#include <fstream>
#include <map>
#include <iostream>
#include <utility>
#include <set>
#include <algorithm>
#include <bitset>
#include <queue>
#include <functional>
#include <assert.h>
#include <ctime>
#include <utility>
#include <stack>
#include <stdint.h>
#define SI(i) scanf("%d ", &i)
#define SII(i,j) scanf("%d%d", &i, &j)
#define SFF(i,j) scanf("%.9lf%.9lf", &i, &j)
#define SIII(i,j, k) scanf("%d%d%d", &i, &j, &k)
#define SF(i) scanf("%.9lf", &i)
#define SFFF(i,j, k) scanf("%.9lf%.9lf%.9lf", &i, &j, &k)
#define SL(i) scanf("%I64", &i)
#define SLL(i,j) scanf("%I64%I64", &i, &j)
#define SLLL(i,j, k) scanf("%I64 %I64 %I64", &i, &j, &k)
#define SS(i) scanf("%s\n", i)
#define SSS(i,j) scanf("%s %s", i, j)
#define SC(i) scanf("%c ", &i)
#define SCC(i,j) scanf("%c %c\n", &i, &j)

#define PF(i) printf("%.9lf", i)
#define PI(i) printf("%d ", i)
#define PI2(i) printf("%d", i)
#define PII(i,j) printf("%d %d ", i, j)
#define PL(i) printf("%I64 ", i)
#define PLS(i) printf("%I64", i)
#define PLL(i,j) printf("%I64 %I64 ", i, j)
#define PS(i) printf("%s", i)
#define PSS(i,j) printf("%s %s ", i, j)
#define PC(i) printf("%c", i)
#define PCC(i,j) printf("%c%c ", i, j)
#define PN printf("\n")
#define forin(i, k, n) for(int32_t i = (k); i < (n); ++i)
#define forin2(i, k, n) for(int32_t i = (k); i <= (n); ++i)
#define rforin(i, k, n) for(int32_t i = (k); i > (n); --i)
#pragma comment(linker, "/STACK:100000000000")
using namespace std;
int n, m, a[1001], b[1001];
double res = 10e9;
int main() {
#ifdef _DEBUG
	freopen("1.in", "rt", stdin);
	freopen("1.out", "wt", stdout);
#endif
	SII(n, m);
	forin(i, 0, n) {
		SI(a[i]);
	}
	forin(i, 0, n) {
		SI(b[i]);
	}
	double ratio = res / 2.;
	double res_t = res + m;
	while (true) {
		res = res_t;
		forin(i, 0, n - 1) {
			res_t -= res_t / a[i];
			res_t -= res_t / b[i + 1];
		}
		res_t -= res_t / a[n - 1];
	    res_t -= res_t / b[0];
		if (res_t > (double)m) {
			res_t = res - ratio;
		}
		else {
			res_t = res + ratio;
		}
		ratio /= 2.;
		if (ratio <= 0.000001) {
			break;
		}
	}
	if (res_t - m> 10e9) {
		PI(-1);
	}
	else {
		PF(res_t - m);
	}
}


#include <iostream>
#include <string>
#include <vector>
using namespace std;
const int maxn = 10005;
int n,m,a[maxn],b[maxn];

bool check(double x)
{
	double sum=m+x;
	if(sum>m)
		sum-=sum/a[1];
	else
		return 0;
	for(int i = 2 ; i <= n ; i++)
	{
		if(sum>m)
			sum-=sum/a[i];
		else
			return 0;
		if(sum>m)
			sum-=sum/b[i];

		else
			return 0;
	}
	if(sum>m)
		sum-=sum/b[1];
	else
		return 0;
	if(sum>=m)
		return 1;
	else
		return 0;
}
int main()
{
	//freopen("in.txt","r",stdin);
	int i;
	while(cin>>n>>m)
	{
		for( i = 1 ; i <= n ; i++)
			cin>>a[i];
		for( i = 1 ; i <= n ; i++)
			cin>>b[i];
		double l=0,r=1000000010,mid,ans=-1;
		int flag=0;
		while(r-l>=0.000001)
		{
			mid=(l+r)/2.0;
			if(check(mid))
			{
				ans=mid;
				r=mid;
				flag=1;
			}
			else
				l=mid;
		}
		if(!flag)cout<<-1;
		else
			printf("%.10f",ans);
	}
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
using namespace std;
const int maxn = 10005;
int n,m,a[maxn],b[maxn];

bool check(double x)
{
	double sum=m+x;
	if(sum>m)
		sum-=sum/a[1];
	else
		return 0;
	for(int i = 2 ; i <= n ; i++)
	{
		if(sum>m)
			sum-=sum/a[i];
		else
			return 0;
		if(sum>m)
			sum-=sum/b[i];

		else
			return 0;
	}
	if(sum>m)
		sum-=sum/b[1];
	else
		return 0;
	if(sum>=m)
		return 1;
	else
		return 0;
}
int main()
{
	//freopen("in.txt","r",stdin);
	int i;
	while(cin>>n>>m)
	{
		for( i = 1 ; i <= n ; i++)
			cin>>a[i];
		for( i = 1 ; i <= n ; i++)
			cin>>b[i];
		double l=0,r=1000000010,mid,ans=-1;
		int flag=0;
		while(r-l>=0.0000001)
		{
			mid=(l+r)/2.0;
			if(check(mid))
			{
				ans=mid;
				r=mid;
				flag=1;
			}
			else
				l=mid;
		}
		if(!flag)cout<<-1;
		else
			printf("%.10f",ans);
	}
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
const int maxn =1010;
double a[maxn],b[maxn];

int main()
{
	//freopen("in.txt","r",stdin);
	int n,i;
	double m;
	while(cin>>n>>m)
	{
		int flag=0;
		for( i = 1 ; i <= n ; i++)
		{
			cin>>a[i];
			if(a[i]<=1)
				flag=1;
		}
		for( i = 1 ; i <= n ; i++)
		{
			cin>>b[i];
			if(b[i]<=1)
				flag=1;
		}
		if(flag)
		{
			cout<<"-1"<<endl;
			continue;
		}
		double sum=0;
		double y;
		for( i = 1 ; i <= n ; i++)
		{
			y=m/(a[i]-1);
			m+=y;
			sum+=y;
			y=m/(b[i]-1);
			m+=y;
			sum+=y;
		}
		printf("%.10f\n",sum);
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int a[10001], b[10001];
int main()
{
	int payload, planetCount;
	while (~scanf("%d%d", &planetCount, &payload))
	{
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < planetCount; i++)
			scanf("%d" ,a + i);
		for (int i = 0; i < planetCount; i++)
			scanf("%d", b + i);
		a[planetCount] = a[0];
		b[planetCount] = b[0];
		double l = 0, r = 1e10;
		double m;
		while (abs(r - l) > 1e-6)
		{
			m = (l + r) / 2;
			bool can = true;
			double fuel = m;
			for (int i = 0; i < planetCount; i++)
			{
				double weight = fuel + payload;
				double used = weight / a[i];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
				weight = fuel + payload;
				used = weight / b[i+1];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
			}
			if (can)
				r = m;
			else
				l = m;
		}
		if (l > 1e9)
			cout << -1 << endl;
		else
			printf("%.7f\n", l);
	}
    return 0;
}


// ConsoleApplication1.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int a[10001], b[10001];
int main()
{
	int payload, planetCount;
	while (~scanf("%d%d", &planetCount, &payload))
	{
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < planetCount; i++)
			scanf("%d" ,a + i);
		for (int i = 0; i < planetCount; i++)
			scanf("%d", b + i);
		a[planetCount] = a[0];
		b[planetCount] = b[0];
		double l = 0, r = 1e10;
		double m;
		while (abs(r - l) > 1e-6)
		{
			m = (l + r) / 2;
			bool can = true;
			double fuel = m;
			for (int i = 0; i < planetCount; i++)
			{
				double weight = fuel + payload;
				double used = weight / a[i];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
				weight = fuel + payload;
				used = weight / b[i+1];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
			}
			if (can)
				r = m;
			else
				l = m;
		}
		if (l > 1e9)
			cout << -1 << endl;
		else
			printf("%.7f\n", l);
	}
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int a[10001], b[10001];
int main()
{
	int payload, planetCount;
	while (~scanf("%d%d", &planetCount, &payload))
	{
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < planetCount; i++)
			scanf("%d" ,a + i);
		for (int i = 0; i < planetCount; i++)
			scanf("%d", b + i);
		a[planetCount] = a[0];
		b[planetCount] = b[0];
		double l = 0, r = 1e10;
		double m;
		while (abs(r - l) > 1e-6)
		{
			m = (l + r) / 2;
			bool can = true;
			double fuel = m;
			for (int i = 0; i < planetCount; i++)
			{
				double weight = fuel + payload;
				double used = weight / a[i];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
				weight = fuel + payload;
				used = weight / b[i+1];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
			}
			if (can)
				r = m;
			else
				l = m;
		}
		if (l > 1e10)
			cout << -1 << endl;
		else
			printf("%.7f\n", l);
	}
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int a[10001], b[10001];
int main()
{
	int payload, planetCount;
	while (cin >> planetCount >> payload)
	{
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < planetCount; i++)
			cin >> a[i];
		for (int i = 0; i < planetCount; i++)
			cin >> b[i];
		a[planetCount] = a[0];
		b[planetCount] = b[0];
		double l = 0, r = 1e10;
		double m;
		while (r - l > 1e-7)
		{
			m = (l + r) / 2;
			bool can = true;
			double fuel = m;
			for (int i = 0; i < planetCount; i++)
			{
				double weight = fuel + payload;
				double used = weight / a[i];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
				weight = fuel + payload;
				used = weight / b[i+1];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
			}
			if (can)
				r = m;
			else
				l = m;
		}
		if (l > 1e9)
			cout << -1 << endl;
		else
			printf("%.7f\n", l);
	}
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int a[10001], b[10001];
int main()
{
	int payload, planetCount;
	while (~scanf("%d%d", &planetCount, &payload))
	{
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < planetCount; i++)
			scanf("%d" ,a + i);
		for (int i = 0; i < planetCount; i++)
			scanf("%d", b + i);
		a[planetCount] = a[0];
		b[planetCount] = b[0];
		double l = 0, r = 2e10;
		double m;
		while (abs(r - l) > 1e-6)
		{
			m = (l + r) / 2;
			bool can = true;
			double fuel = m;
			for (int i = 0; i < planetCount; i++)
			{
				double weight = fuel + payload;
				double used = weight / a[i];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
				weight = fuel + payload;
				used = weight / b[i+1];
				fuel -= used;
				if (fuel < 0)
				{
					can = false;
					break;
				}
			}
			if (can)
				r = m;
			else
				l = m;
		}
		if (l > 1e10)
			cout << -1 << endl;
		else
			printf("%.7f\n", l);
	}
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int sequence[1000];
int main()
{
	int n, m;
	cin >> m >> n;
	for (int i = 0; i < n; i++)
	{
		cout << 1 << endl;
		fflush(stdout);
		cin >> sequence[i];
		if (sequence[i] == 0)
			exit(0);
	}
	int l = 2, r = m;
	int t;
	for (int i = 0; i < 30; i++)
	{
		int mid = (l + r) / 2;
		cout << mid << endl;
		fflush(stdout);
		cin >> t;
		if (t == 0)
		{
			exit(0);
		}
		if (t == sequence[i % n])
		{
			r = mid;
		}
		else
		{
			l = mid + 1;
		}
	}
	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
	int n,m,flag=1;
	double sum=0,temp=0,take[1010]={0},land[1010]={0};
	cin>>n>>m;
	for (int i=0;i<n;i++)
	{
		cin>>take[i];
	}
	for (int i=0;i<n;i++)
	{
		cin>>land[i];
	}

	for (int i=0;i<n;i++)
	{
		if (land[i]==1||take[i]==1)
		{
			flag=0;
			cout<<-1<<endl;
			break;
		}
	}
	if (flag)
	{
		temp=(m*land[0])/(land[0]-1);
		for (int i=1;i<n;i++)
		{
			temp=(temp*take[n-i])/(take[n-i]-1);
			temp=(temp*land[n-i])/(land[n-i]-1);
		}
		temp=(temp*take[0])/(take[0]-1);
		sum=temp-m;
		printf("%.10lf\n",sum);
	}
	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
	int n,m,take[1010]={0},land[1010]={0},flag=1;
	double sum=0,temp=0;
	cin>>n>>m;
	for (int i=0;i<n;i++)
	{
		cin>>take[i];
	}
	for (int i=0;i<n;i++)
	{
		cin>>land[i];
	}

	for (int i=0;i<n;i++)
	{
		if (land[i]==1||take[i]==1)
		{
			flag=0;
			cout<<-1<<endl;
			break;
		}
	}
	if (flag)
	{
		temp=(m*land[0])/(land[0]-1);
		for (int i=1;i<n;i++)
		{
			temp=(temp*take[n-i])/(take[n-i]-1);
			temp=(temp*land[n-i])/(land[n-i]-1);
		}
		temp=(temp*take[0])/(take[0]-1);
		sum=temp-m;
		printf("%.10lf\n",sum);
	}

	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
	int n,m,take[1010]={0},land[1010]={0},flag=1;
	double sum=0,temp=0;
	cin>>n>>m;
	for (int i=0;i<n;i++)
	{
		cin>>take[i];
	}
	for (int i=0;i<n;i++)
	{
		cin>>land[i];
	}

	for (int i=0;i<n;i++)
	{
		if (land[i]==1||take[i]==1)
		{
			flag=0;
			cout<<-1<<endl;
			break;
		}
	}
	if (flag)
	{
		temp=(m*land[0])/(land[0]-1);
		for (int i=1;i<n;i++)
		{
			temp=(temp*take[n-i])/(take[n-i]-1);
			temp=(temp*land[n-i])/(land[n-i]-1);
		}
		temp=(temp*take[0])/(take[0]-1);
		sum=temp-m;
		printf("%.10lf\n",sum);
	}
	return 0;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n,__;
const double eps = 1e-5;
int main(){
    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9+1;
    while(l+eps<r){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;
    }
    if(l+eps>1e9+1)
    printf("-1\n");
    else
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }
    ind=ind-(ind)/jl[1];
    return ind;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n;
const double eps = 1e-7;
int main(){

    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9;
    while(l+eps<r){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;
    }
    if(l+eps>1e9)
    printf("-1\n");
    else
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }

    ind=ind-(ind)/jl[1];
    return ind;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n,__;
const double eps = 1e-5;
int main(){
    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9+1;
    int i=2000;
    while(i--){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;
    }
    if(l+eps>1e9+1)
    printf("-1\n");
    else
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }
    ind=ind-(ind)/jl[1];
    return ind;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n;
const double eps = 1e-7;
int main(){

    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9;
    while(l+eps<r){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;

    }
    if(l+eps>1e9)
    printf("-1\n");
    else
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }

    ind=ind-(ind)/jl[1];
    return ind;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n,__;
const double eps = 1e-7;
int main(){
    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9;
    while(l+eps<r){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;
    }

    if(l+eps>1e9)
    printf("-1\n");
    else
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }
    ind=ind-(ind)/jl[1];
    return ind;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n;
const double eps = 1e-7;
int main(){

    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9;
    while(l+eps<r){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;
    }
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }

    ind=ind-(ind)/jl[1];
    return ind;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n;
const double eps = 1e-7;
int main(){

    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9;
    while(l+eps<r){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;
    }
    if(l+eps>1e9)
    printf("-1\n");
    else
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }
    ind=ind-(ind)/jl[1];
    return ind;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n,__;
const double eps = 1e-5;
int main(){
    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9;
    while(l+eps<r){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;
    }
    if(l+eps>1e9)
    printf("-1\n");
    else
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }
    ind=ind-(ind)/jl[1];
    return ind;
}


#include <cstdio>
const int maxn=2000;
int fly[maxn];
int jl[maxn];
double judge(double in);
int index;
int n;
const double eps = 1e-7;
int main(){

    scanf("%d",&n);
    scanf("%d",&index);
    for(int i=1;i<=n;i++)scanf("%d",&fly[i]);
    for(int i=1;i<=n;i++)scanf("%d",&jl[i]);
    double l=1,r=1e9;
    while(l+eps<r){
        double mid=(l+r)/2.0;
        double ans=judge(mid);
        if(ans>index)r=mid;
        else l=mid;
    }
    if(l+eps>r)
        printf("-1\n");
    else
    printf("%lf\n",l);
    return 0;
}
double judge(double in){
    double ind=index+in;
    int f=0;//0未起飞
    for(int i=1;i<=n;i++){
        if(f==0){
            ind=ind-(ind/fly[i]);
            f=1;
        }
        else{
            ind=ind-(ind/jl[i]);
            ind=ind-(ind/fly[i]);
            f=1;
        }
    }

    ind=ind-(ind)/jl[1];
    return ind;
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	if (!f(1e9+0.000001)) {
		cout << -1; return 0;
	}
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}

	printf("%.10lf", lo);
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	int flag = 0;
	for (i = 1; i <= 20000; i++) {
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid, flag = 1;
		else lo = mid;
	}
	if (!flag) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	freopen("a.txt", "r", stdin);
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	int flag = 0;
	for (i = 1; i <= 200000; i++) {
		if (lo == hi) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid, flag = 1;
		else lo = mid;
	}
	if (!flag) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	for (i = 1; i <= 20000; i++) {
		if (lo == hi) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (!f(1e9+1)) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 2e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (lo == 0.0 || lo > 1e9) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	int flag = 0;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid, flag = 1;
		else lo = mid;
	}
	if (!flag) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	if (!f(1e9+0.000001)) {
		cout << -1;
	}
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}

	printf("%.10lf", lo);
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (!f(1e9+1)) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 2e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (lo == 0.0 || !f(lo)) {
		cout << -1;
	}
	else {
		if (lo > 1e9) lo = 1e9;
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (!f(1e9)) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 2e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (lo == 0.0) {
		cout << -1;
	}
	else {
		if (lo > 1e9) lo = 1e9;
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (lo == 0.0 || (1e9-lo<=0.0000001 && !f(1e9))) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (lo == 0.0 || (lo == 1e9 && !f(1e9))) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (!f(1e9+0.1)) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	int flag = 0;
	for (i = 1; i <= 1000000; i++) {
		if (lo == hi) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid, flag = 1;
		else lo = mid;
	}
	if (!flag) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	for (i = 1; i <= 2000; i++) {
		if (hi - lo <= 0.0000001) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid;
		else lo = mid;
	}
	if (lo == 0.0 || (hi == 1e9 && !f(1e9))) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<utility>
#include<map>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
int A[1004], B[1004], n, m;
int f(double xx) {
	int i;
	double yy;
	yy = xx;
	for (i = 1; i < n; i++) {
		yy -= (double)(yy + m) / A[i];
		if (yy < 0) return 0;
		yy -= (double)(yy + m) / B[i + 1];
		if (yy < 0) return 0;
	}
	yy -= (double)(yy + m) / A[n];
	if (yy < 0) return 0;
	yy -= (double)(yy + m) / B[1];
	if (yy < 0) return 0;
	return 1;
}
int main() {
	int i; double lo, hi, mid;
	cin >> n >> m;
	for (i = 1; i <= n; i++) cin >> A[i];
	for (i = 1; i <= n; i++) cin >> B[i];
	lo = 0; hi = 1e9;
	int flag = 0;
	for (i = 1; i <= 200000; i++) {
		//if (hi - lo <= 0.0000001) break;
		if (lo == hi) break;
		mid = (lo + hi) / 2;
		if (f(mid)) hi = mid, flag = 1;
		else lo = mid;
	}
	if (!flag) {
		cout << -1;
	}
	else {
		printf("%.10lf", lo);
	}
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define ll long long
#define mp make_pair
int main()
{
	std::ios::sync_with_stdio(false);
	int i,n,m,a[1005],b[1005];
	bool flag=false;
	cin>>n;
	cin>>m;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]==1)flag=true;
	}
	for(i=0;i<n;i++)
	{
		cin>>b[i];
		if(b[i]==1)flag=true;
	}
	b[n]=b[0];
	if(flag)cout<<-1<<endl;
	else{
		double ans=m;
		for(i=n;i>=1;i--)
		{
			ans+=(ans/(b[i]-1));
			ans+=(ans/(a[i-1]-1));
		}
		printf("%.10lf\n",ans-m);
	}
	return 0;
}


#include<cstdio>
#include<iostream>
using namespace std;
int n,m,a[1005],b[1005],i,j;
int judge(double x)
{
	x+=m;
	for(i=0;i<n-1;i++)
	{
		x-=x/a[i];
		if(x<m)
			return -1;
		x-=x/b[i+1];
		if(x<m)
			return -1;
	}
	x-=x/a[n-1];
	if(x<m)
			return -1;
	x-=x/b[0];
	if(x<m)
		return -1;
	else if(x>m)
		return 1;
	else
		return 0;
}
int main()
{
	double p,l,r,mid;
	cin>>n>>m;
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=0;i<n;i++)
		cin>>b[i];
	l=0;r=1e10;
	bool tap=0;
	while(r-l>=0.0000005)
	{
		mid=(r+l)/2;
		int flag=judge(mid);
		if(flag==0)
		{
			l=r=mid;
			tap=1;
			break;
		}
		else if(flag==1)
			tap=1,r=mid;
		else
			l=mid;
	}
	p=mid;
	if(!tap)
		printf("-1\n");
	else
		printf("%.7f\n",p);
}


#include<cstdio>
#include<iostream>
using namespace std;
int n,m,a[1005],b[1005],i,j;
int judge(double x)
{
	x+=m;
	for(i=0;i<n-1;i++)
	{
		x-=x/a[i];
		if(x<m)
			return -1;
		x-=x/b[i+1];
		if(x<m)
			return -1;
	}
	x-=x/a[n-1];
	if(x<m)
			return -1;
	x-=x/b[0];
	if(x<m)
		return -1;
	else if(x>m)
		return 1;
	else
		return 0;
}
int main()
{
	double p,l,r,mid;
	cin>>n>>m;
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=0;i<n;i++)
		cin>>b[i];
	l=0;r=1e9;
	while(r-l>=0.0000005)
	{
		mid=(r+l)/2;
		int flag=judge(mid);
		if(flag==0)
		{
			l=r=mid;
			break;
		}
		else if(flag==1)
			r=mid;
		else
			l=mid;
	}
	p=mid;
	if(p>1e9-0.000001)
		printf("-1\n");
	else
		printf("%.7f\n",p);
}


#include<cstdio>
#include<iostream>
using namespace std;
int n,m,a[1005],b[1005],i,j;
int judge(double x)
{
	x+=m;
	for(i=0;i<n-1;i++)
	{
		x-=x/a[i];
		if(x<m)
			return -1;
		x-=x/b[i+1];
		if(x<m)
			return -1;
	}
	x-=x/a[n-1];
	if(x<m)
			return -1;
	x-=x/b[0];
	if(x<m)
		return -1;
	else if(x>m)
		return 1;
	else
		return 0;
}
int main()
{
	double p,l,r,mid;
	cin>>n>>m;
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=0;i<n;i++)
		cin>>b[i];
	l=0;r=1e9;
	bool tap=0;
	while(r-l>=0.0000005)
	{
		mid=(r+l)/2;
		int flag=judge(mid);
		if(flag==0)
		{
			l=r=mid;
			tap=1;
			break;
		}
		else if(flag==1)
			tap=1,r=mid;
		else
			l=mid;
	}
	p=mid;
	if(!tap)
		printf("-1\n");
	else
		printf("%.7f\n",p);
}


#pragma warning (disable:4996)
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<sstream>
#include<numeric>
using namespace std;
typedef long long ll;
ll nop, wop, a[1005], b[1005];
double co, bn[2010];
vector<double> noto;
double fuel;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(100);
	cin >> nop >> wop;
	for (ll i = 1; i <= nop; i++)cin >> a[i];
	for (ll i = 1; i <= nop; i++)cin >> b[i];
	noto.push_back(0);
	noto.push_back(a[1]);
	for (ll i = 2; i <= nop; i++)
	{
		noto.push_back(b[i]);
		noto.push_back(a[i]);
	}
	noto.push_back(b[1]);
	for (ll i = 1; i < noto.size(); i++)
	{
		if (noto[i]==1)
		{
			cout << -1;
			return 0;
		}
	}
	for (ll i = 1; i < noto.size(); i++)
	{
		bn[i] = 1LL / noto[i];
	}
	co = 1;
	for (ll i = 1; i < noto.size(); i++)
	{
		co = co *(1- bn[i]);
	}
	fuel = wop / co - wop;
	cout << fuel;
 	return 0;
}


#include<cstdio>
#include<iostream>
using namespace std;

const int maxn = 1010;

double a[maxn], b[maxn];

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++)
		scanf("%lf", &a[i]);
	for (int i = 0; i < n; i++)
		scanf("%lf", &b[i]);
	for (int i = 0; i < n; i++)
		if (a[i] == 1 || b[i] == 1)
		{
			puts("-1");
			return 0;
		}
	double x = m;
	x += x / (b[0] - 1);
	for (int i = 1; i < n; i++)
		x += x / (a[i] - 1), x += x / (b[i] - 1);
	x += x / (a[0] - 1);
	printf("%.10lf\n", x - m);
	return 0;
}


#define _USE_MATH_DEFINES
#include <assert.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;
typedef long long     ll;
typedef unsigned int  UInt;
#define ALL(a)          (a).begin(), (a).end()
#define FOR(i,a,b)      for(int i = a;   i <  (int)(b); ++i)
#define FOR_REV(i,a,b)  for(int i = b-1; i >= (int)(a); --i)
#define FOR_EACH(it,a)  for(remove_reference<decltype(a)>::type::iterator it = (a).begin(); it != (a).end(); ++it)
#define FOR_EACH_REV(it,a) for(remove_reference<decltype(a)>::type::reverse_iterator it = (a).rbegin(); it != (a).rend(); ++it)
#define FOR_EACH_CONST(it,a) for(remove_reference<decltype(a)>::type::const_iterator it = (a).begin(); it != (a).end(); ++it)
#define FOR_EACH_CONST_REV(it,a) for(remove_reference<decltype(a)>::type::const_reverse_iterator it = (a).rbegin(); it != (a).rend(); ++it)
template<class T> inline T   sqr(T v)  { return v * v; }
template<class T> inline int sign(T v) { return v == 0 ? 0 : (v > 0 ? 1 : -1); }
template<class T> inline int get_bit(T v, int bit_index) { return (v >> bit_index) & 1; } //return {0,1}
template<class T> inline T   gcd(T a, T b) { while(b) { T t = b; b   = a % b; a   = t; } return a; }
#define IN_INT(a)            int a;       is >> a;
#define IN_INT2(a,b)         int a,b;     is >> a >> b;
#define IN_INT3(a,b,c)       int a,b,c;   is >> a >> b >> c;
#define IN_INT4(a,b,c,d)     int a,b,c,d; is >> a >> b >> c >> d;
#define IN_LL(a)             ll a;        is >> a;
#define IN_LL2(a,b)          ll a,b;      is >> a >> b;
#define IN_LL3(a,b,c)        ll a,b,c;    is >> a >> b >> c;
#define IN_LL4(a,b,c,d)      ll a,b,c,d;  is >> a >> b >> c >> d;
#define IN_STR(s)            string s;    is >> s;

//////////////////////////////////////////////////////////////////////////

istream& input(bool release_tie = false)
{
  ios_base::sync_with_stdio(false);
#ifdef INPUT_FROM_FILE
  static ifstream is("CodeForces/input.txt");
  return is;
#endif
  if (release_tie)
    cin.tie(NULL);
  return cin;
}

ostream& output(bool release_tie = false)
{
  cout << setprecision(15);
  if (release_tie)
    cout.tie(NULL);
  return cout;
}

template <typename T>
void init_v2(vector<vector<T>>& v, int lx, int ly, const T& val = T())
{
  v.resize(lx);
  FOR (i,0,lx)
    v[i].resize(ly, val);
};

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
////a
//void main()
//{
//  istream& is = input();
//  ostream& os = output();
//
//  IN_INT2(n,k);
//  IN_STR(s);
//  vector<bool> a(30,false);
//  FOR_EACH (it,s)
//    a[*it-'a'+1]=true;
//  int sum = 0, last=-1, len=0;
//  FOR (i,0,30)
//  {
//    if (a[i]&&i>last+1)
//    {
//      sum+=i;
//      ++len;
//      last = i;
//      if (len==k)
//        break;
//    }
//  }
//
//  os<<(len==k?sum:-1);
//}

//////////////////////////////////////////////////////////////////////////
////b
//void main()
//{
//  istream& is = input();
//  ostream& os = output();
//
//  IN_INT2(n,m);
//  vector<int> a(101,0);
//  FOR (i,0,m)
//  {
//    IN_INT(t);
//    ++a[t];
//  }
//
//  FOR_REV (ans,1,101)
//  {
//    int l = n;
//    FOR_EACH (it,a)
//      l -= *it / ans;
//    if (l<=0)
//    {
//      os<<ans;
//      return;
//    }
//  }
//  os << 0;
//}

//////////////////////////////////////////////////////////////////////////

void main()
{
  istream& is = input();
  ostream& os = output();

  IN_INT2(n,m);

  vector<int> a(n),b(n);
  FOR (i,0,n)
    is >> a[i];
  FOR (i,0,n)
    is >> b[i];

  FOR (i,0,n)
    if (a[i]==1||b[i]==1)
    {
      os<<-1;
      return;
    }

  double lo = 0, hi = 1e9;
  while (hi-lo>1e-6 * max(1.0,lo))
  {
    double f = (hi+lo) / 2;
    bool ok = true;
    FOR (i,0,n)
    {
      int i1 = (i+1)%n;
      double f1 = (m+f)/a[i];
      f-=f1;
      if (f<0)
        ok=false;
      double f2 = (m+f)/b[i1];
      f-=f2;
      if (f<0)
        ok=false;
      if (!ok)
        break;
    }

    if (ok)
      hi = (hi+lo) / 2;
    else
      lo = (hi+lo) / 2;
  }

  os << (hi+lo) / 2;
}

//////////////////////////////////////////////////////////////////////////

//void main()
//{
//  istream& is = input();
//  ostream& os = output();
//
//  IN_INT(n);
//
//  //vector<int> a(n);
//  //FOR (i,0,n)
//  //  is >> a[i];
//
//  //int res = 0;
//  //os << res;
//}


#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
	int n, m;
	scanf("%d", &n);
	scanf("%d", &m);

	int a_n[1000] = { 0, };

	int b_n[1000] = { 0, };

	bool invalid = false;

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a_n[i]);
		if (a_n[i] == 1) invalid = true;
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &b_n[i]);
		if (b_n[i] == 1) invalid = true;
	}

	if (invalid)
	{
		cout << -1;
		return 0;
	}
	double ans = (double)m;
	for (int i = 0; i < n; i++)
	{
		//ans = ans * (float)a_n[i]/(float)(a_n[i]-1)*((float)b_n[i] / (float)(b_n[i] - 1));
		ans = ans * (double)a_n[i];
		ans = ans / (double)(a_n[i]-1);
		ans = ans * (double)b_n[i];
		ans = ans / (double)(b_n[i]-1);
	}
	ans = ans - m;

	cout << ans;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
	int n, m;
	scanf("%d", &n);
	scanf("%d", &m);

	int a_n[1000] = { 0, };

	int b_n[1000] = { 0, };

	bool invalid = false;

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a_n[i]);
		if (a_n[i] == 1) invalid = true;
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &b_n[i]);
		if (b_n[i] == 1) invalid = true;
	}

	if (invalid)
	{
		cout << -1;
		return 0;
	}
	double ans = (double)m;
	for (int i = 0; i < n; i++)
	{
		//ans = ans * (float)a_n[i]/(float)(a_n[i]-1)*((float)b_n[i] / (float)(b_n[i] - 1));
		cout << ans << endl;
		ans = ans * (double)a_n[i];
		cout << ans << endl;
		ans = ans / (double)(a_n[i] - 1);
		cout << ans << endl;
		ans = ans * (double)b_n[i];
		cout << ans << endl;
		ans = ans / (double)(b_n[i]-1);
		cout << ans << endl;
	}
	ans = ans - m;

	cout.precision(20);
	cout << ans;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
	int n, m;
	scanf("%d", &n);
	scanf("%d", &m);

	int a_n[1000] = { 0, };

	int b_n[1000] = { 0, };

	bool invalid = false;

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a_n[i]);
		if (a_n[i] == 1) invalid = true;
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &b_n[i]);
		if (b_n[i] == 1) invalid = true;
	}

	if (invalid)
	{
		cout << -1;
		return 0;
	}
	float ans = (float)m;
	for (int i = 0; i < n; i++)
	{
		ans = ans * (float)a_n[i]/(float)(a_n[i]-1)*((float)b_n[i] / (float)(b_n[i] - 1));
	}
	ans = ans - m;

	cout << ans;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
	int n, m;
	scanf("%d", &n);
	scanf("%d", &m);

	int a_n[1000] = { 0, };

	int b_n[1000] = { 0, };

	bool invalid = false;

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a_n[i]);
		if (a_n[i] == 1) invalid = true;
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &b_n[i]);
		if (b_n[i] == 1) invalid = true;
	}

	if (invalid)
	{
		cout << -1;
		return 0;
	}
	float ans = (float)m;
	for (int i = 0; i < n; i++)
	{
		//ans = ans * (float)a_n[i]/(float)(a_n[i]-1)*((float)b_n[i] / (float)(b_n[i] - 1));
		ans = ans * (float)a_n[i];
		ans = ans / (float)(a_n[i]-1);
		ans = ans * (float)b_n[i];
		ans = ans / (float)(b_n[i]-1);
	}
	ans = ans - m;

	cout << ans;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
	int n, m;
	scanf("%d", &n);
	scanf("%d", &m);

	int a_n[1000] = { 0, };

	int b_n[1000] = { 0, };

	bool invalid = false;

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a_n[i]);
		if (a_n[i] == 1) invalid = true;
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &b_n[i]);
		if (b_n[i] == 1) invalid = true;
	}

	if (invalid)
	{
		cout << -1;
		return 0;
	}
	double ans = (double)m;
	for (int i = 0; i < n; i++)
	{
		//ans = ans * (float)a_n[i]/(float)(a_n[i]-1)*((float)b_n[i] / (float)(b_n[i] - 1));
		ans = ans * ((double)a_n[i]/(double)(a_n[i] - 1));
		ans = ans * ((double)b_n[i]/(double)(b_n[i]-1));
	}
	ans = ans - m;

	cout << ans;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
	int n, m;
	scanf("%d", &n);
	scanf("%d", &m);

	int a_n[1000] = { 0, };

	int b_n[1000] = { 0, };

	bool invalid = false;

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a_n[i]);
		if (a_n[i] == 1) invalid = true;
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &b_n[i]);
		if (b_n[i] == 1) invalid = true;
	}

	if (invalid)
	{
		cout << -1;
		return 0;
	}
	double ans = (double)m;
	for (int i = 0; i < n; i++)
	{
		//ans = ans * (float)a_n[i]/(float)(a_n[i]-1)*((float)b_n[i] / (float)(b_n[i] - 1));
		ans = ans * (double)a_n[i];
		ans = ans / (double)(a_n[i] - 1);
		ans = ans * (double)b_n[i];
		ans = ans / (double)(b_n[i]-1);
	}
	ans = ans - m;

	cout.precision(20);
	cout << ans;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <time.h>
//#include <math.h>
#include <cmath>
#include <fstream>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <stdlib.h>
#include <iomanip>
#include <cstdio>
//#include <stdio.h>

using namespace std;

#define flu fflush(stdout)
#define gg return 0
#define mp make_pair

long long mod = 27449/*1e9 + 7*/;
int inf = 1e9;
double eps = 1e-2;

ifstream in("input.txt");
ofstream out("output.txt");

int main()
{
	int n;
	double m;
	cin >> n >> m;
	vector<double> a, b;
	for (int i = 0; i < n; i++)
	{
		double t;
		cin >> t;
		if (t == 1) { cout << -1; return 0; }
		a.push_back(t);
	}

	for (int i = 0; i < n; i++)
	{
		double t;
		cin >> t;
		if (t == 1) { cout << -1; return 0; }
		b.push_back(t);
	}
	double ans = 0;

	ans += m / (b[0] - 1);
	m += ans;
	for (int i = n - 1; i >= 1; i--)
	{
		double t = m / (b[i] - 1);
		ans += t;
		m += t;
		t = m / (a[i] - 1);
		ans += t;
		m += t;
	}
	ans += m / (a[0] - 1);
	cout << std::setprecision(30) << ans;

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <time.h>
//#include <math.h>
#include <cmath>
#include <fstream>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <stdlib.h>
#include <iomanip>
#include <cstdio>
//#include <stdio.h>

using namespace std;

#define flu fflush(stdout)
#define gg return 0
#define mp make_pair

long long mod = 27449/*1e9 + 7*/;
int inf = 1e9;
double eps = 1e-2;

ifstream in("input.txt");
ofstream out("output.txt");

int main()
{
	int n;
	double m;
	cin >> n >> m;
	vector<double> a, b;
	for (int i = 0; i < n; i++)
	{
		double t;
		cin >> t;
		if (t == 1) { cout << -1; return 0; }
		a.push_back(t);
	}

	for (int i = 0; i < n; i++)
	{
		double t;
		cin >> t;
		b.push_back(t);
	}
	double ans = 0;

	ans += m / (b[0] - 1);
	m += ans;
	for (int i = n - 1; i >= 1; i--)
	{
		double t = m / (b[i] - 1);
		ans += t;
		m += t;
		t = m / (a[i] - 1);
		ans += t;
		m += t;
	}
	ans += m / (a[0] - 1);
	cout << std::setprecision(30) << ans;

	return 0;
}


n = int(input())
p = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
if 1 in a or 1 in b:
    print(-1)
else:
    transitions = (n-1)*2
    coming = [0]*transitions
    coming[0] = b[0]
    coming[-1] = a[-1]
    for i in range(1,n-1):
        coming[2*i-1] = a[i]
        coming[2*i] = b[i]
    going = [0] * transitions
    going[0] = b[-1]
    going[-1] = a[0]
    for i in range(1,n-1):
        going[i*2] = b[i]
        going[i*2-1] = a[i]
    # print(going,coming)
    ans = p
    ans += ans/(b[0]-1)
    ans += ans/(a[-1]-1)
    # for i in coming:
        # ans += ans/(i-1)
        # print(ans)
    for i in going:
        ans += ans/(i-1)
    print(ans-p)

# if __name__ == '__main__':
#     main()


n = int(input())
mass = int(input())
a = [(int)(x) for x in input().split(' ')]
b = [(int)(x) for x in input().split(' ')]
a.append(a[0])
b.append(b[0])

def can(f):
	for i in range(len(a)-1):
		f -= (mass+f) / a[i]
		if f < 0:
			return False

		f -= (mass+f) / b[i+1]
		if f < 0:
			return False

	return True

left = 0
right = 10000000000

for i in range(200):
	mid = (left+right) / 2
	if can(mid):
		right = mid
	else:
		left = mid

EPS = 1e-6

if abs(left - 10000000000) < EPS:
	print(-1)
else:
	print(left)


N,M=int(input()),int(input())
u,d=[*map(int,input().split())],[*map(int,input().split())]
if d[0] == 1:
  print(-1)
  exit(0)
need = M/(d[0]-1)
for i in range(N - 1, 0, -1):
  if u[i] == 1:
    print(-1)
    exit(0)
  need = (M+need*u[i])/(u[i]-1)
  if d[i] == 1:
    print(-1)
    exit(0)
  need = (M+need*d[i])/(d[i]-1)
if u[0]==1:
  print(-1)
  exit(0)
need = (M+need*u[0])/(u[0]-1)
print('%.15f' % need)


N,M=int(input()),int(input())
u,d=[*map(int,input().split())],[*map(int,input().split())]
if d[0] == 1:
  print(-1)
  exit(0)
need = M / (d[0] - 1)
if need <= 0 or need > 10**9:
  print(-1)
  exit(0)
for i in range(N - 1, 0, -1):
  if u[i] == 1:
    print(-1)
    exit(0)
  need = (M+need*u[i])/(u[i]-1)
  if need <= 0 or need > 10**9:
    print(-1)
    exit(0)
  if d[i] == 1:
    print(-1)
    exit(0)
  need = (M+need*d[i])/(d[i]-1)
  if need <= 0 or need > 10**9:
    print(-1)
    exit(0)
if u[0] == 1:
    print(-1)
    exit(0)
need = (M+need*u[0])/(u[0]-1)
if need <= 0 or need > 10**9:
  print(-1)
  exit(0)
print('%.15f' % need)


N,M=int(input()),int(input())
u,d=[*map(int,input().split())],[*map(int,input().split())]
if d[0] == 1:
  print(-1)
  exit(0)
need = M / (d[0] - 1)
if need <= 0:
  print(-1)
  exit(0)
for i in range(N - 1, 0, -1):
  if u[i] == 1:
    print(-1)
    exit(0)
  need = (M+need*u[i])/(u[i]-1)
  if need <= 0:
    print(-1)
    exit(0)
  if d[i] == 1:
    print(-1)
    exit(0)
  need = (M+need*d[i])/(d[i]-1)
  if need <= 0:
    print(-1)
    exit(0)
if u[0] == 1:
    print(-1)
    exit(0)
need = (M+need*u[0])/(u[0]-1)
if need <= 0:
  print(-1)
  exit(0)
print('%.15f' % need)


n = int(input())
m = int(input())
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]
if 1 in a or 1 in b:
    print(-1)
else:
    m0 = m
    for i in range(n - 1, -1, -1):
        k = b[(i + 1) % n]
        m *= k / (k - 1)
        k = a[i]
        m *= k / (k - 1)
    print('{:.10f}'.format(m - m0))


def fun(mid):
    total = mid + mass
    total -= total / a[0]
    if total < mass:
        return False
    for i in range(1, n):
        if total < mass:
            return False
        total -= total / b[i]
        if total < mass:
            return False
        total -= total / a[i]
    if total < mass:
        return False
    total -= total / b[0]
    if total < mass:
        return False
    return True

n, mass = int(input()), int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = -1
start = 0
end = 10**9
mi = 10**-9
while(start <= end):
    mid = (start + end) / 2
    if(fun(mid)):
        ans = mid
        end = mid - mi
    else:
        start = mid + mi
print(ans)


#include <bits/stdc++.h>
#define ll long long
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define PI 2 * acos(0)
#define ones(n) __builtin_popcount(n)
#define FAST ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MAX 10000
#define debug(x) cerr << #x << " = " << x << '\n';
#define LOOP printf("LOOP!!")
#define READ freopen("input.txt", "r", stdin)
#define PRINT freopen("output.txt", "w", stdout);
#define print(a, b) printf("Case %d: %d\n", a, b)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) sort(all(v)), v.erase(unique(ALL(v)), v.end())
const ll MOD = 1e9 + 7;
using namespace std;

bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 2)
        if (n % i == 0)
            return false;

    return true;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    ll ans = (a * b) / g;
    return ans;
}

///palindrome check!
bool palindrome(string s)
{
    for (ll i = 0; i < s.length() / 2; i++)
    {
        if (s[i] != s[s.length() - i - 1])
            return 0;
    }
    return 1;
}

/// divisors->>
void printDivisors(int n)
{
    for (int i = 1; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            if (n / i == i)
                printf("%d ", i);

            else

                printf("%d %d ", i, n / i);
        }
    }
}
/// string to INT
int convert_number(string s)
{
    int n;
    stringstream(s) >> n;
    return n;

    // int v=atoi(ss.c_str());
    // atoi is better than this function in case of complexity
}

///prime storage>>
vector<ll> prime;
void primes(ll m)
{

    bool isprime[m];
    for (int i = 0; i <= m; i++)
        isprime[i] = true;

    for (int i = 3; i * i <= m; i++)
    {
        if (isprime[i])
        {

            for (int j = i * i; j <= m; j += i)
                isprime[j] = false;
        }
    }
    prime.push_back(2);
    for (int i = 3; i <= m; i += 2)
        if (isprime[i])
            prime.push_back(i);
}

int findsum(int n)
{
    int sum = 0;
    if (n != 0)
        return sum = n + findsum(n - 1);
    else
        return 0;
}
/************MAIN_FUNCTION***********/
int main(int argc, char *argv[])
{

    //  FAST;
    int n;
    cin >> n;
    vector<int> v(n);
    int ara[MAX] = {0};
    set<int> s;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        ara[v[i]]++;
        s.insert(v[i]);
    }
    if (s.size() > 3)
    {

        return cout << "Unrecoverable configuration." << '\n', 0;
    }

    if (s.size() == 1)
    {

        cout << "Exemplary pages." << '\n';
        return 0;
    }

    if (n == 2)
    {

        if ((v[0] + v[1]) % 2 == 0)
        {
            if (v[0] > v[1])
                printf("%d ml. from cup #2 to cup #1.", (v[0] + v[1]) / 2);
            else if (v[1] > v[0])
                printf("%d ml. from cup #1 to cup #2.", (v[0] + v[1]) / 2);
        }

        else
            cout << "Unrecoverable configuration." << '\n';

        return 0;
    }

    if (n == 3)
    {
        int l = 0, r = 0;

        if ((v[0] + v[1] + v[2]) % 3 == 0)
        {
            if (v[0] < v[1] && v[0] < v[2])
                l = 1;

            else if (v[1] < v[0] && v[1] < v[2])
                l = 2;
            else
                l = 3;

            if (v[0] > v[1] && v[0] > v[2])
                r = 1;

            else if (v[1] > v[0] && v[1] > v[2])
                r = 2;
            else
                r = 3;

            printf("%d ml. from cup #%d to cup #%d.", (v[0] + v[1] + v[2]) / 3, l, r);
        }
        else
            cout << "Unrecoverable configuration." << '\n';
        return 0;
    }
    int save = 0;
    bool ok = false;
    if (n > 3)
    {
        for (int i = 0; i < n; i++)
            if (ara[v[i]] > 1)
            {
                save = v[i];
                ok = true;
                break;
            }
    }

    if (ok)
    {

        int l = 0, r = 0;
        for (int i = 0; i < n; i++)
        {
            if (!l && ara[v[i]] == 1)
            {
                l = i + 1;
                continue;
            }
            if (!r && ara[v[i]] == 1)
            {
                r = i + 1;
                continue;
            }
        }
        //cout << abs(v[l - 1]) - save << '\n';

        if (abs(v[l - 1] - save) == abs(v[r - 1] - save) && l && r)
        {
            if (v[l - 1] < v[r - 1])
                printf("%d ml. from cup #%d to cup #%d.", abs(v[l - 1] - save), l, r);

            else
            {
                printf("%d ml. from cup #%d to cup #%d.", abs(v[l - 1] - save), r, l);
            }
        }

        else
            cout << "Unrecoverable configuration." << '\n';

        return 0;
    }

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define PI 2 * acos(0)
#define ones(n) __builtin_popcount(n)
#define FAST ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MAX 10000
#define debug(x) cerr << #x << " = " << x << '\n';
#define LOOP printf("LOOP!!")
#define READ freopen("input.txt", "r", stdin)
#define PRINT freopen("output.txt", "w", stdout);
#define print(a, b) printf("Case %d: %d\n", a, b)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) sort(all(v)), v.erase(unique(ALL(v)), v.end())
const ll MOD = 1e9 + 7;
using namespace std;

bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 2)
        if (n % i == 0)
            return false;

    return true;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    ll ans = (a * b) / g;
    return ans;
}

///palindrome check!
bool palindrome(string s)
{
    for (ll i = 0; i < s.length() / 2; i++)
    {
        if (s[i] != s[s.length() - i - 1])
            return 0;
    }
    return 1;
}

/// divisors->>
void printDivisors(int n)
{
    for (int i = 1; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            if (n / i == i)
                printf("%d ", i);

            else

                printf("%d %d ", i, n / i);
        }
    }
}
/// string to INT
int convert_number(string s)
{
    int n;
    stringstream(s) >> n;
    return n;

    // int v=atoi(ss.c_str());
    // atoi is better than this function in case of complexity
}

///prime storage>>
vector<ll> prime;
void primes(ll m)
{

    bool isprime[m];
    for (int i = 0; i <= m; i++)
        isprime[i] = true;

    for (int i = 3; i * i <= m; i++)
    {
        if (isprime[i])
        {

            for (int j = i * i; j <= m; j += i)
                isprime[j] = false;
        }
    }
    prime.push_back(2);
    for (int i = 3; i <= m; i += 2)
        if (isprime[i])
            prime.push_back(i);
}

int findsum(int n)
{
    int sum = 0;
    if (n != 0)
        return sum = n + findsum(n - 1);
    else
        return 0;
}
/************MAIN_FUNCTION***********/
int main(int argc, char *argv[])
{

    //  FAST;
    int n;
    cin >> n;
    int ara[MAX] = {0};
    vector<int> v(n);
    set<int> s;

    for (int i = 0; i < n; i++)
    {

        cin >> v[i];
        s.insert(v[i]);
        ara[v[i]]++;
    }
    if (n == 2)
    {
        if (v[0] == v[1])
        {

            cout << "Exemplary pages.
                    "<<'\n';
                return 0;
        }

        if (abs(v[0] - v[1]) % 2 == 0)
        {

            printf("%d ml. from cup #1 to cup #2.", v[0] - (v[0] - v[1]) / 2);
        }
        else
            cout << "Unrecoverable configuration." << '\n';

        return 0;
    }
    if (s.size() != 3 && s.size() != 1)
    {
        cout << "Unrecoverable configuration." << '\n';
        return 0;
    }

    int l = 0, r = 0, save = 0;
    for (int i = 0; i < v.size(); i++)
    {
        if (ara[v[i]] == 1 && !r)
        {
            r = i + 1;
            continue;
        }

        if (ara[v[i]] == 1 && !l)
        {

            l = i + 1;
        }
        if (ara[v[i]] > 1)
        {

            save = v[i];
        }
    }
    if (l && r)
    {
        if (abs(save - v[l - 1]) != abs(save - v[r - 1]))
        {
            cout << "Unrecoverable configuration." << '\n';
            return 0;
        }

        if (v[l - 1] > v[r - 1])
        {
            printf("%d ml. from cup #%d to cup #%d.", abs(v[r - 1] - save), r, l);
        }
        else if (v[l - 1] < v[r - 1])
        {
            printf("%d ml. from cup #%d to cup #%d.", abs(v[r - 1] - save), l, r);
        }
    }

    else
        cout << "Exemplary pages." << '\n';

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define PI 2 * acos(0)
#define ones(n) __builtin_popcount(n)
#define FAST ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MAX 10000
#define debug(x) cerr << #x << " = " << x << '\n';
#define LOOP printf("LOOP!!")
#define READ freopen("input.txt", "r", stdin)
#define PRINT freopen("output.txt", "w", stdout);
#define print(a, b) printf("Case %d: %d\n", a, b)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) sort(all(v)), v.erase(unique(ALL(v)), v.end())
const ll MOD = 1e9 + 7;
using namespace std;

bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 2)
        if (n % i == 0)
            return false;

    return true;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    ll ans = (a * b) / g;
    return ans;
}

///palindrome check!
bool palindrome(string s)
{
    for (ll i = 0; i < s.length() / 2; i++)
    {
        if (s[i] != s[s.length() - i - 1])
            return 0;
    }
    return 1;
}

/// divisors->>
void printDivisors(int n)
{
    for (int i = 1; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            if (n / i == i)
                printf("%d ", i);

            else

                printf("%d %d ", i, n / i);
        }
    }
}
/// string to INT
int convert_number(string s)
{
    int n;
    stringstream(s) >> n;
    return n;

    // int v=atoi(ss.c_str());
    // atoi is better than this function in case of complexity
}

///prime storage>>
vector<ll> prime;
void primes(ll m)
{

    bool isprime[m];
    for (int i = 0; i <= m; i++)
        isprime[i] = true;

    for (int i = 3; i * i <= m; i++)
    {
        if (isprime[i])
        {

            for (int j = i * i; j <= m; j += i)
                isprime[j] = false;
        }
    }
    prime.push_back(2);
    for (int i = 3; i <= m; i += 2)
        if (isprime[i])
            prime.push_back(i);
}

int findsum(int n)
{
    int sum = 0;
    if (n != 0)
        return sum = n + findsum(n - 1);
    else
        return 0;
}
/************MAIN_FUNCTION***********/
int main(int argc, char *argv[])
{

    //  FAST;
    int n;
    cin >> n;
    int ara[MAX] = {0};
    vector<int> v(n);
    set<int> s;

    for (int i = 0; i < n; i++)
    {

        cin >> v[i];
        s.insert(v[i]);
        ara[v[i]]++;
    }
    if (n == 2)
    {
        if (abs(v[0] - v[1]) % 2 == 0)
        {

            if (v[0] > v[1])
            {

                printf("%d ml. from cup #1 to cup #2.", v[0] - (v[0] - v[1]) / 2);
            }

            if (v[1] > v[0])
            {

                printf("%d ml. from cup #1 to cup #2.", v[1] - (v[1] - v[2]) / 2);
            }

            if (v[0] == v[1])
            {

                cout << "Exemplary pages." << '\n';
            }
        }

        else
            cout << "Unrecoverable configuration." << '\n';

        return 0;
    }
    if (s.size() != 3 && s.size() != 1)
    {
        cout << "Unrecoverable configuration." << '\n';
        return 0;
    }

    int l = 0, r = 0, save = 0;
    for (int i = 0; i < v.size(); i++)
    {
        if (ara[v[i]] == 1 && !r)
        {
            r = i + 1;
            continue;
        }

        if (ara[v[i]] == 1 && !l)
        {

            l = i + 1;
        }
        if (ara[v[i]] > 1)
        {

            save = v[i];
        }
    }
    if (l && r)
    {
        if (abs(save - v[l - 1]) != abs(save - v[r - 1]))
        {
            cout << "Unrecoverable configuration." << '\n';
            return 0;
        }

        if (v[l - 1] > v[r - 1])
        {
            printf("%d ml. from cup #%d to cup #%d.", abs(v[r - 1] - save), r, l);
        }
        else if (v[l - 1] < v[r - 1])
        {
            printf("%d ml. from cup #%d to cup #%d.", abs(v[r - 1] - save), l, r);
        }
    }

    else
        cout << "Exemplary pages." << '\n';

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define PI 2 * acos(0)
#define ones(n) __builtin_popcount(n)
#define FAST ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MAX 9000000
#define debug(x) cerr << #x << " = " << x << '\n';
#define LOOP printf("LOOP!!")
#define READ freopen("input.txt", "r", stdin)
#define PRINT freopen("output.txt", "w", stdout);
#define print(a, b) printf("Case %d: %d\n", a, b)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) sort(all(v)), v.erase(unique(ALL(v)), v.end())
const ll MOD = 1e9 + 7;
using namespace std;

bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 2)
        if (n % i == 0)
            return false;

    return true;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    ll ans = (a * b) / g;
    return ans;
}

///palindrome check!
bool palindrome(string s)
{
    for (ll i = 0; i < s.length() / 2; i++)
    {
        if (s[i] != s[s.length() - i - 1])
            return 0;
    }
    return 1;
}

/// divisors->>
void printDivisors(int n)
{
    for (int i = 1; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            if (n / i == i)
                printf("%d ", i);

            else

                printf("%d %d ", i, n / i);
        }
    }
}
/// string to INT
int convert_number(string s)
{
    int n;
    stringstream(s) >> n;
    return n;

    // int v=atoi(ss.c_str());
    // atoi is better than this function in case of complexity
}

///prime storage>>
vector<ll> prime;
void primes(ll m)
{

    bool isprime[m];
    for (int i = 0; i <= m; i++)
        isprime[i] = true;

    for (int i = 3; i * i <= m; i++)
    {
        if (isprime[i])
        {

            for (int j = i * i; j <= m; j += i)
                isprime[j] = false;
        }
    }
    prime.push_back(2);
    for (int i = 3; i <= m; i += 2)
        if (isprime[i])
            prime.push_back(i);
}

int findsum(int n)
{
    int sum = 0;
    if (n != 0)
        return sum = n + findsum(n - 1);
    else
        return 0;
}
int ara[MAX] = {0};
/************MAIN_FUNCTION***********/
int main(int argc, char *argv[])
{

    //  FAST;
    int n;
    cin >> n;
    vector<int> v(n);
    set<int> s;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        ara[v[i]]++;
        s.insert(v[i]);
    }
    if (s.size() > 3)
    {

        return cout << "Unrecoverable configuration." << '\n', 0;
    }

    if (s.size() == 1)
    {

        cout << "Exemplary pages." << '\n';
        return 0;
    }

    if (n == 2)
    {

        if ((v[0] + v[1]) % 2 == 0)
        {
            if (v[0] > v[1])
                printf("%d ml. from cup #2 to cup #1.", (v[0] + v[1]) / 2);
            else if (v[1] > v[0])
                printf("%d ml. from cup #1 to cup #2.", (v[0] + v[1]) / 2);
        }

        else
            cout << "Unrecoverable configuration." << '\n';

        return 0;
    }

    if (n == 3)
    {
        int l = 0, r = 0;

        if ((v[0] + v[1] + v[2]) % 3 == 0)
        {
            if (v[0] < v[1] && v[0] < v[2])
                l = 1;

            else if (v[1] < v[0] && v[1] < v[2])
                l = 2;
            else
                l = 3;

            if (v[0] > v[1] && v[0] > v[2])
                r = 1;

            else if (v[1] > v[0] && v[1] > v[2])
                r = 2;
            else
                r = 3;

            printf("%d ml. from cup #%d to cup #%d.", (v[0] + v[1] + v[2]) / 3, l, r);
        }
        else
            cout << "Unrecoverable configuration." << '\n';
        return 0;
    }
    int save = 0;
    bool ok = false;
    if (n > 3)
    {
        for (int i = 0; i < n; i++)
            if (ara[v[i]] > 1)
            {
                save = v[i];
                ok = true;
                break;
            }
    }

    if (ok)
    {

        int l = 0, r = 0;
        for (int i = 0; i < n; i++)
        {
            if (!l && ara[v[i]] == 1)
            {
                l = i + 1;
                continue;
            }
            if (!r && ara[v[i]] == 1)
            {
                r = i + 1;
                continue;
            }
        }
        //cout << abs(v[l - 1]) - save << '\n';

        if (abs(v[l - 1] - save) == abs(v[r - 1] - save) && l && r)
        {
            if (v[l - 1] < v[r - 1])
                printf("%d ml. from cup #%d to cup #%d.", abs(v[l - 1] - save), l, r);

            else
            {
                printf("%d ml. from cup #%d to cup #%d.", abs(v[l - 1] - save), r, l);
            }
        }

        else
            cout << "Unrecoverable configuration." << '\n';

        return 0;
    }

    return 0;
}


#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fr first
#define sc second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 100000
using namespace std;
signed main(){
  int n,x1,x2,x3;
  cin>>n;
  set<int>s;
  vector<int>v(n);
  rep(i,0,n){cin>>v[i];s.insert(v[i]);}
  if(s.size()==1){
    cout<<"Exemplary pages.";
  }
  else if(s.size()==3){
    auto it = s.begin();
    x1 = *it;
    it++;x2=*it;it++;x3=*it;
    if(x1+x3==2*x2){
      auto f = find(all(v),x1);
      int a1 = f-v.begin()+1;
      f = find(all(v),x3);
      int a2 = f-v.begin()+1;
      cout<<x2-x1<<" ml. from cup #"<<a1<<" to cup #"<<a2<<".";
    }
    else{
      cout<<"Unrecoverable configuration.";
    }
  }
  else{
    if(v.size()==2 && s.size()==2 && (v[0]+v[1])%2==0){
      auto it = s.begin();
      x1 = *it;
      it++;x2=*it;
      auto f = find(all(v),x1);
      int a1 = f-v.begin()+1;
      f = find(all(v),x2);
      int a2 = f-v.begin()+1;
      int ans = abs(v[0]-(v[0]+v[1])/2);
      cout<<ans<<" ml. from cup #"<<a1<<" to cup #"<<a2<<".";
    }
    else
    cout<<"Unrecoverable configuration.";
  }
}


#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fr first
#define sc second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 100000
using namespace std;
signed main(){
  int n,x1,x2,x3;
  cin>>n;
  set<int>s;
  vector<int>v(n);
  rep(i,0,n){cin>>v[i];s.insert(v[i]);}
  if(s.size()==1){
    cout<<"Exemplary pages.";
  }
  else if(s.size()==3){
    auto it = s.begin();
    x1 = *it;
    it++;x2=*it;it++;x3=*it;
    if(x1+x3==2*x2){
      auto f = find(all(v),x1);
      int a1 = f-v.begin()+1;
      f = find(all(v),x3);
      int a2 = f-v.begin()+1;
      cout<<x2-x1<<" ml. from cup #"<<a1<<" to cup #"<<a2<<".";
    }
    else{
      cout<<"Unrecoverable configuration.";
    }
  }
  else{
    cout<<"Unrecoverable configuration.";
  }
}


#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fr first
#define sc second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 100000
using namespace std;
signed main(){
  int n,x1,x2,x3;
  cin>>n;
  set<int>s;
  vector<int>v(n);
  rep(i,0,n){cin>>v[i];s.insert(v[i]);}
  if(s.size()==1){
    cout<<"Exemplary pages.";
  }
  else if(s.size()==3){
    auto it = s.begin();
    x1 = *it;
    it++;x2=*it;it++;x3=*it;
    if(x1+x3==2*x2){
      auto f = find(all(v),x1);
      int a1 = f-v.begin()+1;
      f = find(all(v),x3);
      int a2 = f-v.begin()+1;
      cout<<x2-x1<<" ml. from cup #"<<a1<<" to cup #"<<a2<<".";
    }
    else{
      cout<<"Unrecoverable configuration.";
    }
  }
  else{
    if(v.size()==2 && s.size()==2){
      auto it = s.begin();
      x1 = *it;
      it++;x2=*it;
      auto f = find(all(v),x1);
      int a1 = f-v.begin()+1;
      f = find(all(v),x2);
      int a2 = f-v.begin()+1;
      int ans = abs(v[0]-(v[0]+v[1])/2);
      cout<<ans<<" ml. from cup #"<<a1<<" to cup #"<<a2<<".";
    }
    else
    cout<<"Unrecoverable configuration.";
  }
}


#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fr first
#define sc second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 100000
using namespace std;
signed main(){
  int n,x1,x2,x3;
  cin>>n;
  set<int>s;
  vector<int>v(n);
  rep(i,0,n){cin>>v[i];s.insert(v[i]);}
  if(s.size()==1){
    cout<<"Exemplary pages.";
  }
  if(s.size()==3){
    auto it = s.begin();
    x1 = *it;
    it++;x2=*it;it++;x3=*it;
    if(x1+x3==2*x2){
      auto f = find(all(v),x1);
      int a1 = f-v.begin()+1;
      f = find(all(v),x3);
      int a2 = f-v.begin()+1;
      cout<<x2-x1<<" ml. from cup #"<<a1<<" to cup #"<<a2<<".";
    }
    else{
      cout<<"Unrecoverable configuration.";
    }
  }
  else{
    cout<<"Unrecoverable configuration.";
  }
}


#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fr first
#define sc second
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 100000
using namespace std;
signed main(){
  int n,x1,x2,x3;
  cin>>n;
  set<int>s;
  vector<int>v(n);
  rep(i,0,n){cin>>v[i];s.insert(v[i]);}
  if(s.size()==1){
    cout<<"Exemplary pages.";
  }
  else if(s.size()==3){
    auto it = s.begin();
    x1 = *it;
    it++;x2=*it;it++;x3=*it;
    if(x1+x3==2*x2 && count(all(v),x1)==1 && count(all(v),x3)==1){
      auto f = find(all(v),x1);
      int a1 = f-v.begin()+1;
      f = find(all(v),x3);
      int a2 = f-v.begin()+1;
      cout<<x2-x1<<" ml. from cup #"<<a1<<" to cup #"<<a2<<".";
    }
    else{
      cout<<"Unrecoverable configuration.";
    }
  }
  else{
    if(v.size()==2 && s.size()==2 && (v[0]+v[1])%2==0){
      auto it = s.begin();
      x1 = *it;
      it++;x2=*it;
      auto f = find(all(v),x1);
      int a1 = f-v.begin()+1;
      f = find(all(v),x2);
      int a2 = f-v.begin()+1;
      int ans = abs(v[0]-(v[0]+v[1])/2);
      cout<<ans<<" ml. from cup #"<<a1<<" to cup #"<<a2<<".";
    }
    else
    cout<<"Unrecoverable configuration.";
  }
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main(){
	int n; cin >> n;
	vector<pair<int,int>>arr(n);
	for (int i = 0 ; i < n ; i++) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	sort(arr.begin(),arr.end());
	if (arr.size() > 2 && arr[1].first != arr[n-2].first) {
		cout << "Unrecoverable configuration.";
	} else {
		if (arr[0].first == arr.back().first) cout << "Exemplary pages.";
		else cout << (arr.back().first - arr[0].first) / 2 << " ml. from cup #" << arr[0].second << " to cup #" << arr.back().second << '.';

	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main(){
	int n; cin >> n;
	vector<pair<int,int>>arr(n);
	for (int i = 0 ; i < n ; i++) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	sort(arr.begin(),arr.end());
	if (arr.size() > 1 && arr[1].first != arr[n-2].first) {
		cout << "Unrecoverable configuration.";
	} else {
		if (arr[0].first == arr.back().first) cout << "Exemplary pages.";
		else cout << (arr.back().first - arr[0].first) / 2 << " ml. from cup #" << arr[0].second << " to cup #" << arr.back().second << '.';

	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main(){
	int n; cin >> n;
	vector<pair<int,int>>arr(n);
	for (int i = 0 ; i < n ; i++) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	sort(arr.begin(),arr.end());
	int total = 0;
	for (auto i : arr) total += i.first;
	if ((arr.size() > 2 && arr[1].first != arr[n-2].first) || total % n) {
		cout << "Unrecoverable configuration.";
	} else {
		if (arr[0].first == arr.back().first) cout << "Exemplary pages.";
		else cout << (arr.back().first - arr[0].first) / 2 << " ml. from cup #" << arr[0].second << " to cup #" << arr.back().second << '.';

	}
}


//ssenseeeeeeeeeeeeeeeeeeeeeeeeeeeee
#include<bits/stdc++.h>
#define startt ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef unsigned long long ull;
typedef long long  ll;
#define MOD 1000000007
#define MX 1000000000
#define NMAX 100005
#define MXL 1000000000000000000
#define PI 3.14159265
#define pb push_back
using namespace std;
#define sc second
#define endl '\n'
#define fr first

int main(){
    startt
    int n;
    cin >> n;
    int a[n+1];
    int mx = 0;
    int mn = MX;
    int sum = 0;
    set<int> s;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
        sum+=a[i];
        s.insert(a[i]);
    }
    int nr = sum/n;
    if(nr*n != sum || (s.size() != 3 && n >= 3))
    {
        cout << "Unrecoverable configuration.";
        return 0;
    }
    if((mx-mn)/2 == 0)
    {
        cout << "Exemplary pages.";
        return 0;
    }
    cout << (mx-mn)/2 << " ml. from cup #";
    for(int i = 0; i < n; i++)
    {
        if(a[i] == nr-(mx-mn)/2)
        {
            cout << i+1;
            break;
        }
    }
    cout << " to cup #";
    for(int i = 0; i < n; i++)
    {
        if(a[i] == nr+(mx-mn)/2)
        {
            cout << i+1 << ".";
            break;
        }
    }
}