program main
implicit None
	character*10::s
	integer::i,k,a,b,c
	
	read *,s
	
	k = len_trim(s)
	
	do i  = 1,k-2
		read(s(i:i),*) a
		b = a * 100
		read(s(i+1:i+1),*) a
		b = b + a * 10
		read(s(i+2:i+2),*) a
		b = b + a
		a = abs(b - 753)
		
		if(i == 1) c = a
		if(c > a) c = a
	enddo
	
	print 101,c
	
101 format(i0)
end program main
; 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"

@_QQcl.d09731452357e9f1a90ab6ccde8f6de0 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5333/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca [10 x i8], align 1
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.d09731452357e9f1a90ab6ccde8f6de0, i32 6)
  %4 = call i1 @_FortranAioInputAscii(ptr %3, ptr nonnull %2, i64 10)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  br label %6

6:                                                ; preds = %0, %6
  %7 = phi i64 [ 9, %0 ], [ %11, %6 ]
  %8 = getelementptr [10 x [1 x i8]], ptr %2, i64 0, i64 %7
  %9 = load i8, ptr %8, align 1, !tbaa !3
  %10 = icmp eq i8 %9, 32
  %11 = add nsw i64 %7, -1
  %12 = icmp ne i64 %7, 0
  %13 = and i1 %10, %12
  br i1 %13, label %6, label %14

14:                                               ; preds = %6
  %.op = shl i64 %7, 32
  %sext = add i64 %.op, -4294967296
  %15 = ashr exact i64 %sext, 32
  %spec.select14 = select i1 %10, i64 -2, i64 %15
  %16 = icmp sgt i64 %spec.select14, 0
  br i1 %16, label %select.unfold, label %select.unfold._crit_edge

select.unfold:                                    ; preds = %14, %select.unfold
  %indvars.iv = phi i64 [ %indvars.iv.next, %select.unfold ], [ 1, %14 ]
  %.016 = phi i32 [ %.2, %select.unfold ], [ undef, %14 ]
  %17 = add nsw i64 %indvars.iv, -1
  %18 = getelementptr [10 x [1 x i8]], ptr %2, i64 0, i64 %17
  %19 = call ptr @_FortranAioBeginInternalListInput(ptr %18, i64 1, ptr null, i64 0, ptr nonnull @_QQcl.d09731452357e9f1a90ab6ccde8f6de0, i32 11)
  %20 = call i1 @_FortranAioInputInteger(ptr %19, ptr nonnull %1, i32 4)
  %21 = call i32 @_FortranAioEndIoStatement(ptr %19)
  %22 = load i32, ptr %1, align 4, !tbaa !3
  %23 = mul i32 %22, 100
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %sext19 = shl i64 %indvars.iv.next, 32
  %24 = ashr exact i64 %sext19, 32
  %25 = add nsw i64 %24, -1
  %26 = getelementptr [10 x [1 x i8]], ptr %2, i64 0, i64 %25
  %27 = call ptr @_FortranAioBeginInternalListInput(ptr %26, i64 1, ptr null, i64 0, ptr nonnull @_QQcl.d09731452357e9f1a90ab6ccde8f6de0, i32 13)
  %28 = call i1 @_FortranAioInputInteger(ptr %27, ptr nonnull %1, i32 4)
  %29 = call i32 @_FortranAioEndIoStatement(ptr %27)
  %30 = load i32, ptr %1, align 4, !tbaa !3
  %31 = mul i32 %30, 10
  %32 = add i32 %31, %23
  %33 = shl i64 %indvars.iv, 32
  %sext20 = add i64 %33, 8589934592
  %34 = ashr exact i64 %sext20, 32
  %35 = add nsw i64 %34, -1
  %36 = getelementptr [10 x [1 x i8]], ptr %2, i64 0, i64 %35
  %37 = call ptr @_FortranAioBeginInternalListInput(ptr %36, i64 1, ptr null, i64 0, ptr nonnull @_QQcl.d09731452357e9f1a90ab6ccde8f6de0, i32 15)
  %38 = call i1 @_FortranAioInputInteger(ptr %37, ptr nonnull %1, i32 4)
  %39 = call i32 @_FortranAioEndIoStatement(ptr %37)
  %40 = load i32, ptr %1, align 4, !tbaa !3
  %41 = add i32 %32, %40
  %42 = add i32 %41, -753
  %43 = icmp slt i32 %42, 0
  %44 = sub i32 753, %41
  %45 = select i1 %43, i32 %44, i32 %42
  store i32 %45, ptr %1, align 4, !tbaa !3
  %46 = icmp eq i64 %indvars.iv, 1
  %spec.select = select i1 %46, i32 %45, i32 %.016
  %.2 = call i32 @llvm.smin.i32(i32 %spec.select, i32 %45)
  %exitcond.not = icmp eq i64 %indvars.iv, %spec.select14
  br i1 %exitcond.not, label %select.unfold._crit_edge, label %select.unfold

select.unfold._crit_edge:                         ; preds = %select.unfold, %14
  %.0.lcssa = phi i32 [ undef, %14 ], [ %.2, %select.unfold ]
  %47 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.d09731452357e9f1a90ab6ccde8f6de0, i32 23)
  %48 = call i1 @_FortranAioOutputInteger32(ptr %47, i32 %.0.lcssa)
  %49 = call i32 @_FortranAioEndIoStatement(ptr %47)
  ret void
}

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

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

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

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

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, 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.smin.i32(i32, i32) #0

attributes #0 = { 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"}
