

function Main(input) {
  input = input.split("\n");
  var R = parseInt(input[0].split(" ")[0]);
  var G = parseInt(input[0].split(" ")[1]);
  var B = parseInt(input[0].split(" ")[2]);
  var N = parseInt(input[0].split(" ")[3]);
  var ans=new Array(N+1);
  ans[0]=[1,0,0];
  for(var i=1;i<N+1;i++){
    tmp = new Array(3).fill(0);
    ans[i]=tmp;
  }
  var rgb=[R,G,B];
  rgb.sort(function(a, b){return a-b});
  R=rgb[0];
  G=rgb[1];
  B=rgb[2];
  for(var i=1;i<N+1;i++){
    if(i>=R){
      ans[i]=[ans[i][0]+ans[i-R][0],ans[i][0]+ans[i-R][0],ans[i][2]];
    }
    if(i>=G){
      ans[i]=[ans[i][0]+(ans[i-G][0]-ans[i-G][1]),ans[i][1],(ans[i-G][0]-ans[i-G][1])];
    }
    if(i>=B){
      ans[i]=[ans[i][0]+(ans[i-B][0]-ans[i-B][1]-ans[i-B][2]),ans[i][1],ans[i][2]];
    }
  }
  var ans=ans[N][0];
  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));