(* O(n^2) *)
let solve r g b n =
  let rec find_g acc g0 m =
    if g0 * g > m then
      acc
    else
      find_g 
        (acc + if (m - g0 * g) mod b = 0 then 1 else 0)
        (g0 + 1)
        m in
  let rec count acc r0 =
    if r0 * r > n then
      acc
    else
      count (find_g acc 0 (n - r0 * r)) (r0 + 1)
  in
    count 0 0

let read_ints () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  match read_ints () with
  | [r; g; b; n] -> solve r g b n |> string_of_int |> print_endline
  | _ -> assert false