import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val input = new Scanner(in)

    lazy val output = new PrintStream(out)

    val A = 0
    val R = 1
    val G = 2
    val B = 3

    def solve(): Unit = {
      val Array(ns, as, bs, ks) = input.nextLine().split(" ")
      val n = ns.toInt
      val a = as.toInt
      val b = bs.toInt
      val k = ks.toLong
      var c = 0

      loop(n, a, b, k) { colors =>
        c += 1
      }
      output.println(c)
    }

    def loop(n: Int, a: Int, b: Int, k: Long)(f: Seq[Int] => Unit): Unit = {
      val colors = Array.fill(n)(A)
      if (calc(a, b, colors) == k) {
        f(colors)
      }

      1.until(Math.pow(n, 4).toInt).foreach { i =>
        val colors = Array.tabulate(n) { x =>
          i / Math.pow(4, x).toInt % 4
        }

        if (calc(a, b, colors) == k) {
          f(colors)
        }
      }
    }

    def calc(a: Int, b: Int, colors: Seq[Int]): Int = {
      val sum = colors.map {
        case 1 => a
        case 2 => a + b
        case 3 => b
        case _ => 0
      }.sum
      sum
    }

  }

}
