#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: nofree nounwind 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) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %g) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
  %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)
  %0 = load i32, ptr %n, align 4, !tbaa !5
  %1 = load i32, ptr %r, align 4, !tbaa !5
  %div = sdiv i32 %0, %1
  %cmp.not24 = icmp slt i32 %div, 0
  br i1 %cmp.not24, label %for.cond.cleanup, label %for.cond1.preheader.lr.ph

for.cond1.preheader.lr.ph:                        ; preds = %entry
  %2 = load i32, ptr %g, align 4, !tbaa !5
  %div2 = sdiv i32 %0, %2
  %cmp3.not21 = icmp slt i32 %div2, 0
  %3 = load i32, ptr %b, align 4
  br i1 %cmp3.not21, label %for.cond.cleanup, label %for.cond1.preheader.preheader

for.cond1.preheader.preheader:                    ; preds = %for.cond1.preheader.lr.ph
  %4 = add i32 %div2, 1
  %min.iters.check = icmp ult i32 %4, 8
  %n.vec = and i32 %4, -8
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %2, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert34 = insertelement <4 x i32> poison, i32 %0, i64 0
  %broadcast.splat35 = shufflevector <4 x i32> %broadcast.splatinsert34, <4 x i32> poison, <4 x i32> zeroinitializer
  %cmp.n = icmp eq i32 %4, %n.vec
  br label %for.cond1.preheader

for.cond1.preheader:                              ; preds = %for.cond1.preheader.preheader, %for.cond1.for.cond.cleanup4_crit_edge
  %ans.026 = phi i32 [ %ans.2.lcssa, %for.cond1.for.cond.cleanup4_crit_edge ], [ 0, %for.cond1.preheader.preheader ]
  %x.025 = phi i32 [ %inc12, %for.cond1.for.cond.cleanup4_crit_edge ], [ 0, %for.cond1.preheader.preheader ]
  %mul.neg = mul i32 %1, %x.025
  br i1 %min.iters.check, label %for.body5.preheader, label %vector.ph

vector.ph:                                        ; preds = %for.cond1.preheader
  %5 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %ans.026, i64 0
  %broadcast.splatinsert32 = insertelement <4 x i32> poison, i32 %mul.neg, i64 0
  %broadcast.splat33 = shufflevector <4 x i32> %broadcast.splatinsert32, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %pred.srem.continue49, %vector.ph
  %index = phi i32 [ 0, %vector.ph ], [ %index.next, %pred.srem.continue49 ]
  %vec.phi = phi <4 x i32> [ %5, %vector.ph ], [ %predphi, %pred.srem.continue49 ]
  %vec.phi30 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi50, %pred.srem.continue49 ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %pred.srem.continue49 ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %6 = mul <4 x i32> %broadcast.splat, %vec.ind
  %7 = mul <4 x i32> %broadcast.splat, %step.add
  %8 = add <4 x i32> %6, %broadcast.splat33
  %9 = add <4 x i32> %7, %broadcast.splat33
  %10 = sub <4 x i32> %broadcast.splat35, %8
  %11 = sub <4 x i32> %broadcast.splat35, %9
  %12 = icmp sgt <4 x i32> %10, <i32 -1, i32 -1, i32 -1, i32 -1>
  %13 = icmp sgt <4 x i32> %11, <i32 -1, i32 -1, i32 -1, i32 -1>
  %14 = extractelement <4 x i1> %12, i64 0
  br i1 %14, label %pred.srem.if, label %pred.srem.continue

pred.srem.if:                                     ; preds = %vector.body
  %15 = extractelement <4 x i32> %10, i64 0
  %16 = srem i32 %15, %3
  %17 = insertelement <4 x i32> poison, i32 %16, i64 0
  br label %pred.srem.continue

pred.srem.continue:                               ; preds = %pred.srem.if, %vector.body
  %18 = phi <4 x i32> [ poison, %vector.body ], [ %17, %pred.srem.if ]
  %19 = extractelement <4 x i1> %12, i64 1
  br i1 %19, label %pred.srem.if36, label %pred.srem.continue37

pred.srem.if36:                                   ; preds = %pred.srem.continue
  %20 = extractelement <4 x i32> %10, i64 1
  %21 = srem i32 %20, %3
  %22 = insertelement <4 x i32> %18, i32 %21, i64 1
  br label %pred.srem.continue37

pred.srem.continue37:                             ; preds = %pred.srem.if36, %pred.srem.continue
  %23 = phi <4 x i32> [ %18, %pred.srem.continue ], [ %22, %pred.srem.if36 ]
  %24 = extractelement <4 x i1> %12, i64 2
  br i1 %24, label %pred.srem.if38, label %pred.srem.continue39

pred.srem.if38:                                   ; preds = %pred.srem.continue37
  %25 = extractelement <4 x i32> %10, i64 2
  %26 = srem i32 %25, %3
  %27 = insertelement <4 x i32> %23, i32 %26, i64 2
  br label %pred.srem.continue39

pred.srem.continue39:                             ; preds = %pred.srem.if38, %pred.srem.continue37
  %28 = phi <4 x i32> [ %23, %pred.srem.continue37 ], [ %27, %pred.srem.if38 ]
  %29 = extractelement <4 x i1> %12, i64 3
  br i1 %29, label %pred.srem.if40, label %pred.srem.continue41

pred.srem.if40:                                   ; preds = %pred.srem.continue39
  %30 = extractelement <4 x i32> %10, i64 3
  %31 = srem i32 %30, %3
  %32 = insertelement <4 x i32> %28, i32 %31, i64 3
  br label %pred.srem.continue41

pred.srem.continue41:                             ; preds = %pred.srem.if40, %pred.srem.continue39
  %33 = phi <4 x i32> [ %28, %pred.srem.continue39 ], [ %32, %pred.srem.if40 ]
  %34 = extractelement <4 x i1> %13, i64 0
  br i1 %34, label %pred.srem.if42, label %pred.srem.continue43

pred.srem.if42:                                   ; preds = %pred.srem.continue41
  %35 = extractelement <4 x i32> %11, i64 0
  %36 = srem i32 %35, %3
  %37 = insertelement <4 x i32> poison, i32 %36, i64 0
  br label %pred.srem.continue43

pred.srem.continue43:                             ; preds = %pred.srem.if42, %pred.srem.continue41
  %38 = phi <4 x i32> [ poison, %pred.srem.continue41 ], [ %37, %pred.srem.if42 ]
  %39 = extractelement <4 x i1> %13, i64 1
  br i1 %39, label %pred.srem.if44, label %pred.srem.continue45

pred.srem.if44:                                   ; preds = %pred.srem.continue43
  %40 = extractelement <4 x i32> %11, i64 1
  %41 = srem i32 %40, %3
  %42 = insertelement <4 x i32> %38, i32 %41, i64 1
  br label %pred.srem.continue45

pred.srem.continue45:                             ; preds = %pred.srem.if44, %pred.srem.continue43
  %43 = phi <4 x i32> [ %38, %pred.srem.continue43 ], [ %42, %pred.srem.if44 ]
  %44 = extractelement <4 x i1> %13, i64 2
  br i1 %44, label %pred.srem.if46, label %pred.srem.continue47

pred.srem.if46:                                   ; preds = %pred.srem.continue45
  %45 = extractelement <4 x i32> %11, i64 2
  %46 = srem i32 %45, %3
  %47 = insertelement <4 x i32> %43, i32 %46, i64 2
  br label %pred.srem.continue47

pred.srem.continue47:                             ; preds = %pred.srem.if46, %pred.srem.continue45
  %48 = phi <4 x i32> [ %43, %pred.srem.continue45 ], [ %47, %pred.srem.if46 ]
  %49 = extractelement <4 x i1> %13, i64 3
  br i1 %49, label %pred.srem.if48, label %pred.srem.continue49

pred.srem.if48:                                   ; preds = %pred.srem.continue47
  %50 = extractelement <4 x i32> %11, i64 3
  %51 = srem i32 %50, %3
  %52 = insertelement <4 x i32> %48, i32 %51, i64 3
  br label %pred.srem.continue49

pred.srem.continue49:                             ; preds = %pred.srem.if48, %pred.srem.continue47
  %53 = phi <4 x i32> [ %48, %pred.srem.continue47 ], [ %52, %pred.srem.if48 ]
  %54 = icmp eq <4 x i32> %33, zeroinitializer
  %55 = icmp eq <4 x i32> %53, zeroinitializer
  %narrow = select <4 x i1> %12, <4 x i1> %54, <4 x i1> zeroinitializer
  %56 = zext <4 x i1> %narrow to <4 x i32>
  %predphi = add <4 x i32> %vec.phi, %56
  %narrow51 = select <4 x i1> %13, <4 x i1> %55, <4 x i1> zeroinitializer
  %57 = zext <4 x i1> %narrow51 to <4 x i32>
  %predphi50 = add <4 x i32> %vec.phi30, %57
  %index.next = add nuw i32 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %58 = icmp eq i32 %index.next, %n.vec
  br i1 %58, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %pred.srem.continue49
  %bin.rdx = add <4 x i32> %predphi50, %predphi
  %59 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n, label %for.cond1.for.cond.cleanup4_crit_edge, label %for.body5.preheader

for.body5.preheader:                              ; preds = %for.cond1.preheader, %middle.block
  %ans.123.ph = phi i32 [ %ans.026, %for.cond1.preheader ], [ %59, %middle.block ]
  %y.022.ph = phi i32 [ 0, %for.cond1.preheader ], [ %n.vec, %middle.block ]
  br label %for.body5

for.cond.cleanup:                                 ; preds = %for.cond1.for.cond.cleanup4_crit_edge, %for.cond1.preheader.lr.ph, %entry
  %ans.0.lcssa = phi i32 [ 0, %entry ], [ 0, %for.cond1.preheader.lr.ph ], [ %ans.2.lcssa, %for.cond1.for.cond.cleanup4_crit_edge ]
  %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %g) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
  ret i32 0

for.cond1.for.cond.cleanup4_crit_edge:            ; preds = %if.end, %middle.block
  %ans.2.lcssa = phi i32 [ %59, %middle.block ], [ %ans.2, %if.end ]
  %inc12 = add nuw i32 %x.025, 1
  %exitcond29.not = icmp eq i32 %x.025, %div
  br i1 %exitcond29.not, label %for.cond.cleanup, label %for.cond1.preheader

for.body5:                                        ; preds = %for.body5.preheader, %if.end
  %ans.123 = phi i32 [ %ans.2, %if.end ], [ %ans.123.ph, %for.body5.preheader ]
  %y.022 = phi i32 [ %inc10, %if.end ], [ %y.022.ph, %for.body5.preheader ]
  %mul6.neg = mul i32 %2, %y.022
  %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.123, %inc
  br label %if.end

if.end:                                           ; preds = %land.lhs.true, %for.body5
  %ans.2 = phi i32 [ %ans.123, %for.body5 ], [ %spec.select, %land.lhs.true ]
  %inc10 = add nuw i32 %y.022, 1
  %exitcond.not = icmp eq i32 %y.022, %div2
  br i1 %exitcond.not, label %for.cond1.for.cond.cleanup4_crit_edge, label %for.body5, !llvm.loop !12
}

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

; Function Attrs: nofree nounwind
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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3

attributes #0 = { nofree nounwind 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 = { nofree nounwind "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }

!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"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
