#import <stdio.h>
int main() {
    int r, g, b, n, ans = 0;
    scanf("%d %d %d %d", &r, &g, &b, &n);
    for (int x = 0; x <= n / r; x++) {
        for (int y = 0; y <= n / g; y++) {
            int p = n - r * x - g * y;
            if (p >= 0 && p % b == 0) ans++;
        }
    }
    printf("%d\n", ans);
}

; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_297/source.m'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_297/source.m"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1

; Function Attrs: minsize nofree nounwind optsize uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
  %r = alloca i32, align 4
  %g = alloca i32, align 4
  %b = alloca i32, align 4
  %n = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
  %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %g, ptr noundef nonnull %b, ptr noundef nonnull %n) #4
  %0 = load i32, ptr %n, align 4, !tbaa !5
  %1 = load i32, ptr %r, align 4, !tbaa !5
  %div = sdiv i32 %0, %1
  %2 = load i32, ptr %g, align 4
  %3 = load i32, ptr %b, align 4
  br label %for.cond

for.cond:                                         ; preds = %for.cond.cleanup4, %entry
  %x.0 = phi i32 [ 0, %entry ], [ %inc12, %for.cond.cleanup4 ]
  %ans.0 = phi i32 [ 0, %entry ], [ %ans.1, %for.cond.cleanup4 ]
  %cmp.not = icmp sgt i32 %x.0, %div
  br i1 %cmp.not, label %for.cond.cleanup, label %for.cond1.preheader

for.cond1.preheader:                              ; preds = %for.cond
  %div2 = sdiv i32 %0, %2
  %mul.neg = mul i32 %1, %x.0
  br label %for.cond1

for.cond.cleanup:                                 ; preds = %for.cond
  %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
  ret i32 0

for.cond1:                                        ; preds = %for.cond1.preheader, %if.end
  %y.0 = phi i32 [ %inc10, %if.end ], [ 0, %for.cond1.preheader ]
  %ans.1 = phi i32 [ %ans.2, %if.end ], [ %ans.0, %for.cond1.preheader ]
  %cmp3.not = icmp sgt i32 %y.0, %div2
  br i1 %cmp3.not, label %for.cond.cleanup4, label %for.body5

for.cond.cleanup4:                                ; preds = %for.cond1
  %inc12 = add nuw nsw i32 %x.0, 1
  br label %for.cond

for.body5:                                        ; preds = %for.cond1
  %mul6.neg = mul i32 %2, %y.0
  %reass.add = add i32 %mul6.neg, %mul.neg
  %sub7 = sub i32 %0, %reass.add
  %cmp8 = icmp sgt i32 %sub7, -1
  br i1 %cmp8, label %land.lhs.true, label %if.end

land.lhs.true:                                    ; preds = %for.body5
  %rem = srem i32 %sub7, %3
  %cmp9 = icmp eq i32 %rem, 0
  %inc = zext i1 %cmp9 to i32
  %spec.select = add nsw i32 %ans.1, %inc
  br label %if.end

if.end:                                           ; preds = %land.lhs.true, %for.body5
  %ans.2 = phi i32 [ %ans.1, %for.body5 ], [ %spec.select, %land.lhs.true ]
  %inc10 = add nuw nsw i32 %y.0, 1
  br label %for.cond1
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: minsize nofree nounwind optsize
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: minsize nofree nounwind optsize
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

attributes #0 = { minsize nofree nounwind optsize uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { minsize nofree nounwind optsize "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
attributes #4 = { minsize optsize }

!llvm.linker.options = !{}
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
