implicit none
integer:: n, i, j, a, b, ans, t
integer,allocatable,dimension(:):: p

read(5,*) n, a, b
allocate(p(n))
read(5,*) (p(i),i=1,n)

ans = 1
t = abs( (1000 * b) - (1000 * a) + (6 * p(1)) )

do i = 1, n
    if ( t > abs( (1000 * b) - (1000 * a) + (6 * p(i)) ) ) then
        ans = i
        t = abs( (1000 * b) - (1000 * a) + (6 * p(i)) )
    endif
enddo
    
write(6, *) ans

end
; 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"

@_QFEp.0 = internal unnamed_addr global ptr null
@_QQcl.a2bd5e0a8d8c8b0a9208db9d05028f03 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5381/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.a2bd5e0a8d8c8b0a9208db9d05028f03, i32 5)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %1, i32 4)
  %7 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 4)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %9 = load i32, ptr %3, align 4, !tbaa !3
  %10 = call i32 @llvm.smax.i32(i32 %9, i32 0)
  %11 = zext i32 %10 to i64
  %12 = shl nuw nsw i64 %11, 2
  %13 = call ptr @malloc(i64 %12)
  store ptr %13, ptr @_QFEp.0, align 8, !tbaa !7
  %14 = call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.a2bd5e0a8d8c8b0a9208db9d05028f03, i32 7)
  %15 = load i32, ptr %3, align 4, !tbaa !3
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %17 = zext i32 %15 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %18 = phi i64 [ %23, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %.unpack132 = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %sext = shl i64 %18, 32
  %19 = ashr exact i64 %sext, 32
  %20 = add nsw i64 %19, -1
  %21 = getelementptr i32, ptr %.unpack132, i64 %20
  %22 = call i1 @_FortranAioInputInteger(ptr %14, ptr %21, i32 4)
  %23 = add nuw nsw i64 %18, 1
  %exitcond.not = icmp eq i64 %18, %17
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %24 = call i32 @_FortranAioEndIoStatement(ptr %14)
  %25 = load i32, ptr %2, align 4, !tbaa !3
  %26 = load i32, ptr %1, align 4, !tbaa !3
  %reass.add = sub i32 %25, %26
  %reass.mul = mul i32 %reass.add, 1000
  %.unpack = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %27 = load i32, ptr %3, align 4, !tbaa !3
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph148.preheader, label %._crit_edge149

.lr.ph148.preheader:                              ; preds = %._crit_edge
  %29 = zext i32 %27 to i64
  %30 = load i32, ptr %.unpack, align 4, !tbaa !3
  %31 = mul i32 %30, 6
  %32 = add i32 %31, %reass.mul
  %33 = call i32 @llvm.abs.i32(i32 %32, i1 false)
  %xtraiter = and i64 %29, 1
  %34 = icmp eq i32 %27, 1
  br i1 %34, label %._crit_edge149.loopexit.unr-lcssa, label %.lr.ph148.preheader.new

.lr.ph148.preheader.new:                          ; preds = %.lr.ph148.preheader
  %unroll_iter = and i64 %29, 4294967294
  br label %.lr.ph148

.lr.ph148:                                        ; preds = %.lr.ph148, %.lr.ph148.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph148.preheader.new ], [ %indvars.iv.next.1, %.lr.ph148 ]
  %.0146 = phi i32 [ %33, %.lr.ph148.preheader.new ], [ %spec.select144.1, %.lr.ph148 ]
  %.094145 = phi i32 [ 1, %.lr.ph148.preheader.new ], [ %spec.select.1, %.lr.ph148 ]
  %niter = phi i64 [ 0, %.lr.ph148.preheader.new ], [ %niter.next.1, %.lr.ph148 ]
  %35 = add nsw i64 %indvars.iv, -1
  %36 = getelementptr i32, ptr %.unpack, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !3
  %38 = mul i32 %37, 6
  %39 = add i32 %38, %reass.mul
  %40 = call i32 @llvm.abs.i32(i32 %39, i1 false)
  %41 = icmp sgt i32 %.0146, %40
  %42 = trunc i64 %indvars.iv to i32
  %spec.select = select i1 %41, i32 %42, i32 %.094145
  %spec.select144 = call i32 @llvm.smin.i32(i32 %.0146, i32 %40)
  %43 = getelementptr i32, ptr %.unpack, i64 %indvars.iv
  %44 = load i32, ptr %43, align 4, !tbaa !3
  %45 = mul i32 %44, 6
  %46 = add i32 %45, %reass.mul
  %47 = call i32 @llvm.abs.i32(i32 %46, i1 false)
  %48 = icmp sgt i32 %spec.select144, %47
  %49 = trunc i64 %indvars.iv to i32
  %50 = add i32 %49, 1
  %spec.select.1 = select i1 %48, i32 %50, i32 %spec.select
  %spec.select144.1 = call i32 @llvm.smin.i32(i32 %spec.select144, i32 %47)
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge149.loopexit.unr-lcssa, label %.lr.ph148

._crit_edge149.loopexit.unr-lcssa:                ; preds = %.lr.ph148, %.lr.ph148.preheader
  %spec.select.lcssa.ph = phi i32 [ undef, %.lr.ph148.preheader ], [ %spec.select.1, %.lr.ph148 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph148.preheader ], [ %indvars.iv.next.1, %.lr.ph148 ]
  %.0146.unr = phi i32 [ %33, %.lr.ph148.preheader ], [ %spec.select144.1, %.lr.ph148 ]
  %.094145.unr = phi i32 [ 1, %.lr.ph148.preheader ], [ %spec.select.1, %.lr.ph148 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge149, label %.lr.ph148.epil

.lr.ph148.epil:                                   ; preds = %._crit_edge149.loopexit.unr-lcssa
  %51 = add nsw i64 %indvars.iv.unr, -1
  %52 = getelementptr i32, ptr %.unpack, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !3
  %54 = mul i32 %53, 6
  %55 = add i32 %54, %reass.mul
  %56 = call i32 @llvm.abs.i32(i32 %55, i1 false)
  %57 = icmp sgt i32 %.0146.unr, %56
  %58 = trunc i64 %indvars.iv.unr to i32
  %spec.select.epil = select i1 %57, i32 %58, i32 %.094145.unr
  br label %._crit_edge149

._crit_edge149:                                   ; preds = %.lr.ph148.epil, %._crit_edge149.loopexit.unr-lcssa, %._crit_edge
  %.094.lcssa = phi i32 [ 1, %._crit_edge ], [ %spec.select.lcssa.ph, %._crit_edge149.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph148.epil ]
  %59 = call ptr @_FortranAioBeginExternalListOutput(i32 6, ptr nonnull @_QQcl.a2bd5e0a8d8c8b0a9208db9d05028f03, i32 19)
  %60 = call i1 @_FortranAioOutputInteger32(ptr %59, i32 %.094.lcssa)
  %61 = call i32 @_FortranAioEndIoStatement(ptr %59)
  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 @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #1

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
