L1, L2, L3 = map(int,input().split()) R, B, Y = map(int,input().split()) def red(y, z, round): return (y+z) * 2 * round def yellow(x, y, round): return (x+y) * 2 * round def blue(x, z, round): return (x+z) * 2 * round #全パターン試す # x, y, z val1 = red(L2, L3, R) + yellow(L1, L2, Y) + blue(L1, L3, B) # x, z, y val2 = red(L3, L2, R) + yellow(L1, L3, Y) + blue(L1, L2, B) # y, x, z val3 = red(L1, L3, R) + yellow(L2, L1, Y) + blue(L2, L3, B) # y, z, x val4 = red(L3, L1, R) + yellow(L2, L3, Y) + blue(L2, L1, B) # z, x, y val5 = red(L1, L2, R) + yellow(L3, L1, Y) + blue(L3, L2, B) # z, y, x val6 = red(L2, L1, R) + yellow(L3, L2, Y) + blue(L3, L1, B) print(min(val1, val2, val3, val4, val5, val6))