fun main() {
    val num500 = readLine()!!.toInt()
    val num100 = readLine()!!.toInt()
    val num50 = readLine()!!.toInt()
    val totalCost = readLine()!!.toInt()
    var pattern = 0

    for (i in 0..num500) {
        for (j in 0..num100) {
            for (k in 0..num50) {
                if(totalCost == 500*i + 100*j + 50*k) pattern ++
            }
        }
    }
    println (pattern)
}
