fun main() {
    val A = readLine()!!.toInt()
    val B = readLine()!!.toInt()
    val C = readLine()!!.toInt()

    val X = readLine()!!.toInt()

     (0..A).flatMap { a -> (0..B).flatMap { b -> (0..C).map { c ->
        listOf(500 * a, 100 * b, 50 * c)
    }}}.map { it.sum() }.filter { it == X }.count().let {
        println(it)
    }
}
