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) if (x >= 1) { dpa[x][y][z][i] = (1 - pa) * dpa[x][y][z][i - 1] + pa * (1 + dpa[x - 1][y][z][i - 1]) } else { dpa[x][y][z][i] = dpa[x][y][z][i - 1] } val pb = y * (y - 1.0) / (x + y + z) / (x + y + z - 1.0) if (y >= 1) { dpb[x][y][z][i] = (1 - pb) * dpb[x][y][z][i - 1] + pb * (1 + dpb[x][y - 1][z][i - 1]) } else { dpb[x][y][z][i] = dpb[x][y][z][i - 1] } val pc = z * (z - 1.0) / (x + y + z) / (x + y + z - 1.0) if (z >= 1) { dpc[x][y][z][i] = (1 - pc) * dpc[x][y][z][i - 1] + pc * (1 + dpc[x][y][z - 1][i - 1]) } else { dpc[x][y][z][i] = dpc[x][y][z][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