#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
int A, B, C, D;
double cache[14][14][14][14][5][5];
/*
a, b, c, d 表示ABCD 四种类型的牌的数量
x = 1 2 3 4 分别表示小王已经模到了,且分别放到了ABCD牌堆中,x = 0表示小王还没有摸到
y = 1 2 3 4 分别表示大王已经模到了,且分别放到了ABCD牌堆中,y = 0表示大王还没有摸到
dp(a, b, c, d, x, y) 表示当前状态到任意一种满足条件的最终状态的期望开销
*/
double dp(int a, int b, int c, int d, int x, int y) {
if (cache[a][b][c][d][x][y] > 0) {
return cache[a][b][c][d][x][y];
}
int aa = 0, bb = 0, cc = 0, dd = 0;
for (int val : vector<int>({x, y})) {
switch (val) {
case 1:
aa++; break;
case 2:
bb++; break;
case 3:
cc++; break;
case 4:
dd++; break;
}
}
if (a+aa >= A && b+bb >= B && c+cc >= C && d+dd >= D) {
return 0.0;
}
int S = a + aa + b + bb + c + cc + d + dd;
double ans = 0.0;
if (a < 13) {
ans += ((13.0-a) / (54-S)) * (dp(a+1, b, c, d, x, y) + 1);
}
if (b < 13) {
ans += ((13.0-b) / (54-S)) * (dp(a, b+1, c, d, x, y) + 1);
}
if (c < 13) {
ans += ((13.0-c) / (54-S)) * (dp(a, b, c+1, d, x, y) + 1);
}
if (d < 13) {
ans += ((13.0-d) / (54-S)) * (dp(a, b, c, d+1, x, y) + 1);
}
if (x == 0) {
double min_val = 9999999999.0;
for (int i = 1; i <= 4; i++) {
min_val = min(min_val, dp(a, b, c, d, i, y));
}
ans += (1.0 / (54-S)) * (min_val + 1);
}
if (y == 0) {
double min_val = 9999999999.0;
for (int i = 1; i <= 4; i++) {
min_val = min(min_val, dp(a, b, c, d, x, i));
}
ans += (1.0 / (54-S)) * (min_val + 1);
}
cache[a][b][c][d][x][y] = ans;
return ans;
}
int main(void) {
//freopen("/Users/grh/Programming/CLionProjects/Test/data.txt", "r", stdin);
scanf("%d %d %d %d", &A, &B, &C, &D);
if (A + B + C + D > 54) {
printf("-1.000\n");
return 0;
}
int total = 0;
for (int& val : vector<int>({A, B, C, D})) {
if (val - 13 > 0) {
total += val - 13;
}
}
if (total > 2) {
printf("-1.000\n");
return 0;
}
memset(cache, 0, sizeof(cache));
printf("%.3lf\n", dp(0, 0, 0, 0, 0, 0));
return 0;
}