program ABC085C
    implicit none
    integer(8)::N,Y,i,j
    integer(8)::flg=0
    integer(8)::result(3)
    read(5,*)N,Y

    do i=0,N
        do j=0,N-i
            if(9*i+4*j==Y/1000-N)then
                flg=1
                result(1)=i
                result(2)=j
                result(3)=N-i-j
                exit
            end if
        end do
    end do

    if(flg==0)then
        print'(i0,1x,i0,1x,i0)',-1,-1,-1
    else
        print'(i0,1x,i0,1x,i0)',result(1),result(2),result(3)
    end if
end program ABC085C
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
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"

@_QFEflg = internal unnamed_addr global i1 false
@_QQcl.d2d8fd2ab82afb97f16cc6edf1f336a3 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6459/source.f\00"
@_QQcl.2869302C31782C69302C31782C693029 = linkonce constant [16 x i8] c"(i0,1x,i0,1x,i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.d2d8fd2ab82afb97f16cc6edf1f336a3, i32 6)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 8)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i64, ptr %1, align 8, !tbaa !3
  %8 = icmp ult i64 %7, 9223372036854775807
  br i1 %8, label %.lr.ph25, label %._crit_edge

.lr.ph25:                                         ; preds = %0
  %9 = add nuw nsw i64 %7, 1
  %10 = load i64, ptr %2, align 8
  %11 = sdiv i64 %10, 1000
  %12 = sub i64 %11, %7
  br label %13

13:                                               ; preds = %.lr.ph25, %.loopexit
  %.013.neg24 = phi i64 [ 0, %.lr.ph25 ], [ %.013.neg, %.loopexit ]
  %.sroa.0.023 = phi i64 [ undef, %.lr.ph25 ], [ %.sroa.0.1, %.loopexit ]
  %.sroa.2.022 = phi i64 [ undef, %.lr.ph25 ], [ %.sroa.2.1, %.loopexit ]
  %.sroa.4.021 = phi i64 [ undef, %.lr.ph25 ], [ %.sroa.4.1, %.loopexit ]
  %.01320 = phi i64 [ 0, %.lr.ph25 ], [ %28, %.loopexit ]
  %.01419 = phi i64 [ %9, %.lr.ph25 ], [ %27, %.loopexit ]
  %14 = add nsw i64 %9, %.013.neg24
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %13
  %16 = mul i64 %.01320, 9
  br label %17

17:                                               ; preds = %.lr.ph, %23
  %.018 = phi i64 [ 0, %.lr.ph ], [ %25, %23 ]
  %.01517 = phi i64 [ %14, %.lr.ph ], [ %24, %23 ]
  %18 = shl i64 %.018, 2
  %19 = add i64 %18, %16
  %20 = icmp eq i64 %19, %12
  br i1 %20, label %21, label %23

21:                                               ; preds = %17
  store i1 true, ptr @_QFEflg, align 1
  %.neg = add nsw i64 %.013.neg24, %7
  %22 = sub i64 %.neg, %.018
  br label %.loopexit

23:                                               ; preds = %17
  %24 = add nsw i64 %.01517, -1
  %25 = add nuw nsw i64 %.018, 1
  %26 = icmp sgt i64 %.01517, 1
  br i1 %26, label %17, label %.loopexit

.loopexit:                                        ; preds = %23, %13, %21
  %.sroa.4.1 = phi i64 [ %22, %21 ], [ %.sroa.4.021, %13 ], [ %.sroa.4.021, %23 ]
  %.sroa.2.1 = phi i64 [ %.018, %21 ], [ %.sroa.2.022, %13 ], [ %.sroa.2.022, %23 ]
  %.sroa.0.1 = phi i64 [ %.01320, %21 ], [ %.sroa.0.023, %13 ], [ %.sroa.0.023, %23 ]
  %27 = add i64 %.01419, -1
  %28 = add nuw i64 %.01320, 1
  %.013.neg = xor i64 %.01320, -1
  %29 = icmp sgt i64 %27, 0
  br i1 %29, label %13, label %._crit_edge

._crit_edge:                                      ; preds = %.loopexit, %0
  %.sroa.4.0.lcssa = phi i64 [ undef, %0 ], [ %.sroa.4.1, %.loopexit ]
  %.sroa.2.0.lcssa = phi i64 [ undef, %0 ], [ %.sroa.2.1, %.loopexit ]
  %.sroa.0.0.lcssa = phi i64 [ undef, %0 ], [ %.sroa.0.1, %.loopexit ]
  %.b = load i1, ptr @_QFEflg, align 1
  br i1 %.b, label %35, label %30

30:                                               ; preds = %._crit_edge
  %31 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.2869302C31782C69302C31782C693029, i64 16, ptr null, i32 -1, ptr nonnull @_QQcl.d2d8fd2ab82afb97f16cc6edf1f336a3, i32 21)
  %32 = call i1 @_FortranAioOutputInteger32(ptr %31, i32 -1)
  %33 = call i1 @_FortranAioOutputInteger32(ptr %31, i32 -1)
  %34 = call i1 @_FortranAioOutputInteger32(ptr %31, i32 -1)
  br label %40

35:                                               ; preds = %._crit_edge
  %36 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.2869302C31782C69302C31782C693029, i64 16, ptr null, i32 -1, ptr nonnull @_QQcl.d2d8fd2ab82afb97f16cc6edf1f336a3, i32 23)
  %37 = call i1 @_FortranAioOutputInteger64(ptr %36, i64 %.sroa.0.0.lcssa)
  %38 = call i1 @_FortranAioOutputInteger64(ptr %36, i64 %.sroa.2.0.lcssa)
  %39 = call i1 @_FortranAioOutputInteger64(ptr %36, i64 %.sroa.4.0.lcssa)
  br label %40

40:                                               ; preds = %30, %35
  %.sink = phi ptr [ %31, %30 ], [ %36, %35 ]
  %41 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
