import java.io.PrintWriter import java.util.* import kotlin.math.* fun PrintWriter.solve() { val a = nextInt() val b = nextInt() val c = nextInt() val n = nextInt() val dpa = Array(51) { Array(51) { Array(51) { DoubleArray(51) { 0.0 } } } } val dpb = Array(51) { Array(51) { Array(51) { DoubleArray(51) { 0.0 } } } } val dpc = Array(51) { Array(51) { Array(51) { DoubleArray(51) { 0.0 } } } } for (i in 1..n) { for (x in 0..a) { for (y in 0..b) { for (z in 0..c) { if (x + y + z <= 1) continue val pa = x * (x - 1.0) / (x + y + z) / (x + y + z - 1.0) val pb = y * (y - 1.0) / (x + y + z) / (x + y + z - 1.0) val pc = z * (z - 1.0) / (x + y + z) / (x + y + z - 1.0) dpa[x][y][z][i] = (1 - pa - pb - pc) * dpa[x][y][z][i - 1] dpb[x][y][z][i] = (1 - pa - pb - pc) * dpb[x][y][z][i - 1] dpc[x][y][z][i] = (1 - pa - pb - pc) * dpc[x][y][z][i - 1] if (x >= 1) { dpa[x][y][z][i] += pa * (1 + dpa[x - 1][y][z][i - 1]) dpb[x][y][z][i] += pa * dpb[x - 1][y][z][i - 1] dpc[x][y][z][i] += pa * dpc[x - 1][y][z][i - 1] } if (y >= 1) { dpa[x][y][z][i] += pb * dpa[x][y - 1][z][i - 1] dpb[x][y][z][i] += pb * (1 + dpb[x][y - 1][z][i - 1]) dpc[x][y][z][i] += pb * dpc[x][y - 1][z][i - 1] } if (z >= 1) { dpa[x][y][z][i] += pc * dpa[x][y][z - 1][i - 1] dpb[x][y][z][i] += pc * dpb[x][y][z - 1][i - 1] dpc[x][y][z][i] += pc * (1 + dpc[x][y][z - 1][i - 1]) } } } } } println("${dpa[a][b][c][n]} ${dpb[a][b][c][n]} ${dpc[a][b][c][n]}") } fun main() { Thread(null, { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() }, "solve", 1.shl(26)) .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } } .apply { start() }.join() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion