implicit none
integer:: n,a,b,keta,d,total
integer:: i,j
character(5):: s
 
read(*,*) n,a,b
 
total=0
do i=1,n
write(s,'(i0)') i
 
keta=0
do j=1,len(s)
if(s(j:j)/='')then
read(s(j:j),*) d
keta=keta+d
endif
end do
 
if(keta >= a .and. keta <=b)then
total=total+i
endif
 
end do
 
write(*,*) total
 
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"

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

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [5 x i8], align 1
  %6 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.003b23944f65e61fc74e2574ce35080c, i32 6)
  %7 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %4, i32 4)
  %8 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %1, i32 4)
  %9 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %2, i32 4)
  %10 = call i32 @_FortranAioEndIoStatement(ptr %6)
  %11 = load i32, ptr %4, align 4, !tbaa !3
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %13 = zext i32 %11 to i64
  %14 = getelementptr inbounds [5 x [1 x i8]], ptr %5, i64 0, i64 1
  %15 = getelementptr inbounds [5 x [1 x i8]], ptr %5, i64 0, i64 2
  %16 = getelementptr inbounds [5 x [1 x i8]], ptr %5, i64 0, i64 3
  %17 = getelementptr inbounds [5 x [1 x i8]], ptr %5, i64 0, i64 4
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %61
  %18 = phi i64 [ %69, %61 ], [ %13, %.lr.ph.preheader ]
  %19 = phi i32 [ %68, %61 ], [ 1, %.lr.ph.preheader ]
  %.015 = phi i32 [ %spec.select, %61 ], [ 0, %.lr.ph.preheader ]
  %20 = call ptr @_FortranAioBeginInternalFormattedOutput(ptr nonnull %5, i64 5, ptr nonnull @_QQcl.28693029, i64 4, ptr null, ptr null, i64 0, ptr nonnull @_QQcl.003b23944f65e61fc74e2574ce35080c, i32 10)
  %21 = call i1 @_FortranAioOutputInteger32(ptr %20, i32 %19)
  %22 = call i32 @_FortranAioEndIoStatement(ptr %20)
  %23 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %5, ptr nonnull @_QQcl., i64 1, i64 0)
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %29, label %24

24:                                               ; preds = %.lr.ph
  %25 = call ptr @_FortranAioBeginInternalListInput(ptr nonnull %5, i64 1, ptr null, i64 0, ptr nonnull @_QQcl.003b23944f65e61fc74e2574ce35080c, i32 15)
  %26 = call i1 @_FortranAioInputInteger(ptr %25, ptr nonnull %3, i32 4)
  %27 = call i32 @_FortranAioEndIoStatement(ptr %25)
  %28 = load i32, ptr %3, align 4, !tbaa !3
  br label %29

29:                                               ; preds = %24, %.lr.ph
  %.111 = phi i32 [ %28, %24 ], [ 0, %.lr.ph ]
  %30 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %14, ptr nonnull @_QQcl., i64 1, i64 0)
  %.not.1 = icmp eq i32 %30, 0
  br i1 %.not.1, label %37, label %31

31:                                               ; preds = %29
  %32 = call ptr @_FortranAioBeginInternalListInput(ptr nonnull %14, i64 1, ptr null, i64 0, ptr nonnull @_QQcl.003b23944f65e61fc74e2574ce35080c, i32 15)
  %33 = call i1 @_FortranAioInputInteger(ptr %32, ptr nonnull %3, i32 4)
  %34 = call i32 @_FortranAioEndIoStatement(ptr %32)
  %35 = load i32, ptr %3, align 4, !tbaa !3
  %36 = add i32 %35, %.111
  br label %37

37:                                               ; preds = %31, %29
  %.111.1 = phi i32 [ %36, %31 ], [ %.111, %29 ]
  %38 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %15, ptr nonnull @_QQcl., i64 1, i64 0)
  %.not.2 = icmp eq i32 %38, 0
  br i1 %.not.2, label %45, label %39

39:                                               ; preds = %37
  %40 = call ptr @_FortranAioBeginInternalListInput(ptr nonnull %15, i64 1, ptr null, i64 0, ptr nonnull @_QQcl.003b23944f65e61fc74e2574ce35080c, i32 15)
  %41 = call i1 @_FortranAioInputInteger(ptr %40, ptr nonnull %3, i32 4)
  %42 = call i32 @_FortranAioEndIoStatement(ptr %40)
  %43 = load i32, ptr %3, align 4, !tbaa !3
  %44 = add i32 %43, %.111.1
  br label %45

45:                                               ; preds = %39, %37
  %.111.2 = phi i32 [ %44, %39 ], [ %.111.1, %37 ]
  %46 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %16, ptr nonnull @_QQcl., i64 1, i64 0)
  %.not.3 = icmp eq i32 %46, 0
  br i1 %.not.3, label %53, label %47

47:                                               ; preds = %45
  %48 = call ptr @_FortranAioBeginInternalListInput(ptr nonnull %16, i64 1, ptr null, i64 0, ptr nonnull @_QQcl.003b23944f65e61fc74e2574ce35080c, i32 15)
  %49 = call i1 @_FortranAioInputInteger(ptr %48, ptr nonnull %3, i32 4)
  %50 = call i32 @_FortranAioEndIoStatement(ptr %48)
  %51 = load i32, ptr %3, align 4, !tbaa !3
  %52 = add i32 %51, %.111.2
  br label %53

53:                                               ; preds = %47, %45
  %.111.3 = phi i32 [ %52, %47 ], [ %.111.2, %45 ]
  %54 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %17, ptr nonnull @_QQcl., i64 1, i64 0)
  %.not.4 = icmp eq i32 %54, 0
  br i1 %.not.4, label %61, label %55

55:                                               ; preds = %53
  %56 = call ptr @_FortranAioBeginInternalListInput(ptr nonnull %17, i64 1, ptr null, i64 0, ptr nonnull @_QQcl.003b23944f65e61fc74e2574ce35080c, i32 15)
  %57 = call i1 @_FortranAioInputInteger(ptr %56, ptr nonnull %3, i32 4)
  %58 = call i32 @_FortranAioEndIoStatement(ptr %56)
  %59 = load i32, ptr %3, align 4, !tbaa !3
  %60 = add i32 %59, %.111.3
  br label %61

61:                                               ; preds = %55, %53
  %.111.4 = phi i32 [ %60, %55 ], [ %.111.3, %53 ]
  %62 = load i32, ptr %1, align 4, !tbaa !3
  %63 = icmp sge i32 %.111.4, %62
  %64 = load i32, ptr %2, align 4, !tbaa !3
  %65 = icmp sle i32 %.111.4, %64
  %66 = and i1 %63, %65
  %67 = select i1 %66, i32 %19, i32 0
  %spec.select = add i32 %67, %.015
  %68 = add nuw i32 %19, 1
  %69 = add nsw i64 %18, -1
  %70 = icmp sgt i64 %18, 1
  br i1 %70, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %61, %0
  %.0.lcssa = phi i32 [ 0, %0 ], [ %spec.select, %61 ]
  %71 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.003b23944f65e61fc74e2574ce35080c, i32 26)
  %72 = call i1 @_FortranAioOutputInteger32(ptr %71, i32 %.0.lcssa)
  %73 = call i32 @_FortranAioEndIoStatement(ptr %71)
  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 @_FortranAioBeginInternalFormattedOutput(ptr, i64, ptr, i64, ptr, ptr, i64, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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

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

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) 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"}
