program main
    implicit none
    integer N, i, ans
    integer :: l(1010) = 0
    integer :: r(1010) = 0
    ans = 0
    read *, N
    do i = 1,N
        read *, l(i), r(i)
        ans = ans + r(i) - l(i) + 1
    end do

    print *, ans
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"

@_QFEl = internal global [1010 x i32] zeroinitializer
@_QFEr = internal global [1010 x i32] zeroinitializer
@_QQcl.47561127f390b7071fb78c72efab4a87 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6926/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.47561127f390b7071fb78c72efab4a87, i32 7)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i32, ptr %1, align 4, !tbaa !3
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph.preheader, label %._crit_edge

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

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.07 = phi i32 [ 0, %.lr.ph.preheader ], [ %19, %.lr.ph ]
  %8 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.47561127f390b7071fb78c72efab4a87, i32 9)
  %9 = add nsw i64 %indvars.iv, -1
  %10 = getelementptr [1010 x i32], ptr @_QFEl, i64 0, i64 %9
  %11 = call i1 @_FortranAioInputInteger(ptr %8, ptr %10, i32 4)
  %12 = getelementptr [1010 x i32], ptr @_QFEr, i64 0, i64 %9
  %13 = call i1 @_FortranAioInputInteger(ptr %8, ptr %12, i32 4)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %8)
  %15 = load i32, ptr %12, align 4, !tbaa !3
  %16 = load i32, ptr %10, align 4, !tbaa !3
  %17 = add i32 %.07, 1
  %18 = add i32 %17, %15
  %19 = sub i32 %18, %16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %7
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.0.lcssa = phi i32 [ 0, %0 ], [ %19, %.lr.ph ]
  %20 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.47561127f390b7071fb78c72efab4a87, i32 13)
  %21 = call i1 @_FortranAioOutputInteger32(ptr %20, i32 %.0.lcssa)
  %22 = call i32 @_FortranAioEndIoStatement(ptr %20)
  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

!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"}
