program main
  implicit none
  integer :: a(5), i, res
  res = 0
  do i = 1, 5
    read (*, *) a(i)
    res = res + roundup(a(i))
  end do

  print "(i0)", res - (10 - minlast(a))

  contains

  pure function minlast(a)
    integer, intent(in) :: a(5)
    integer :: minlast
    minlast = minval(mod(a - 1, 10) + 1)
  end function minlast

  pure function roundup(x)
    integer, intent(in) :: x
    integer :: roundup
    roundup = int(ceiling(x * 0.1)) * 10
  end function roundup
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.462d20c6d9410c585a4841b1cab5f5bc = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4557/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca [5 x i32], align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.462d20c6d9410c585a4841b1cab5f5bc, i32 6)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i32, ptr %2, align 4, !tbaa !3
  %7 = sitofp i32 %6 to float
  %8 = fmul contract float %7, 0x3FB99999A0000000
  %9 = call contract float @llvm.ceil.f32(float %8)
  %10 = fptosi float %9 to i32
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.462d20c6d9410c585a4841b1cab5f5bc, i32 6)
  %12 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 1
  %13 = call i1 @_FortranAioInputInteger(ptr %11, ptr nonnull %12, i32 4)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %15 = load i32, ptr %12, align 4, !tbaa !3
  %16 = sitofp i32 %15 to float
  %17 = fmul contract float %16, 0x3FB99999A0000000
  %18 = call contract float @llvm.ceil.f32(float %17)
  %19 = fptosi float %18 to i32
  %20 = add i32 %19, %10
  %21 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.462d20c6d9410c585a4841b1cab5f5bc, i32 6)
  %22 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 2
  %23 = call i1 @_FortranAioInputInteger(ptr %21, ptr nonnull %22, i32 4)
  %24 = call i32 @_FortranAioEndIoStatement(ptr %21)
  %25 = load i32, ptr %22, align 4, !tbaa !3
  %26 = sitofp i32 %25 to float
  %27 = fmul contract float %26, 0x3FB99999A0000000
  %28 = call contract float @llvm.ceil.f32(float %27)
  %29 = fptosi float %28 to i32
  %30 = add i32 %20, %29
  %31 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.462d20c6d9410c585a4841b1cab5f5bc, i32 6)
  %32 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 3
  %33 = call i1 @_FortranAioInputInteger(ptr %31, ptr nonnull %32, i32 4)
  %34 = call i32 @_FortranAioEndIoStatement(ptr %31)
  %35 = load i32, ptr %32, align 4, !tbaa !3
  %36 = sitofp i32 %35 to float
  %37 = fmul contract float %36, 0x3FB99999A0000000
  %38 = call contract float @llvm.ceil.f32(float %37)
  %39 = fptosi float %38 to i32
  %40 = add i32 %30, %39
  %41 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.462d20c6d9410c585a4841b1cab5f5bc, i32 6)
  %42 = getelementptr inbounds [5 x i32], ptr %2, i64 0, i64 4
  %43 = call i1 @_FortranAioInputInteger(ptr %41, ptr nonnull %42, i32 4)
  %44 = call i32 @_FortranAioEndIoStatement(ptr %41)
  %45 = load i32, ptr %42, align 4, !tbaa !3
  %46 = sitofp i32 %45 to float
  %47 = fmul contract float %46, 0x3FB99999A0000000
  %48 = call contract float @llvm.ceil.f32(float %47)
  %49 = fptosi float %48 to i32
  %50 = add i32 %40, %49
  %51 = mul i32 %50, 10
  %52 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.462d20c6d9410c585a4841b1cab5f5bc, i32 10)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1)
  %53 = call dereferenceable_or_null(20) ptr @malloc(i64 20)
  %54 = load i32, ptr %2, align 4, !tbaa !3
  %55 = add i32 %54, -1
  %56 = srem i32 %55, 10
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %53, align 4, !tbaa !3
  %58 = load i32, ptr %12, align 4, !tbaa !3
  %59 = add i32 %58, -1
  %60 = srem i32 %59, 10
  %61 = add nsw i32 %60, 1
  %62 = getelementptr i32, ptr %53, i64 1
  store i32 %61, ptr %62, align 4, !tbaa !3
  %63 = load i32, ptr %22, align 4, !tbaa !3
  %64 = add i32 %63, -1
  %65 = srem i32 %64, 10
  %66 = add nsw i32 %65, 1
  %67 = getelementptr i32, ptr %53, i64 2
  store i32 %66, ptr %67, align 4, !tbaa !3
  %68 = load i32, ptr %32, align 4, !tbaa !3
  %69 = add i32 %68, -1
  %70 = srem i32 %69, 10
  %71 = add nsw i32 %70, 1
  %72 = getelementptr i32, ptr %53, i64 3
  store i32 %71, ptr %72, align 4, !tbaa !3
  %73 = load i32, ptr %42, align 4, !tbaa !3
  %74 = add i32 %73, -1
  %75 = srem i32 %74, 10
  %76 = add nsw i32 %75, 1
  %77 = getelementptr i32, ptr %53, i64 4
  store i32 %76, ptr %77, align 4, !tbaa !3
  store ptr %53, ptr %1, align 8, !tbaa !7
  %.fca.1.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep.i, align 8, !tbaa !7
  %.fca.2.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep.i, align 8, !tbaa !7
  %.fca.3.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep.i, align 4, !tbaa !7
  %.fca.4.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep.i, align 1, !tbaa !7
  %.fca.5.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep.i, align 2, !tbaa !7
  %.fca.6.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep.i, align 1, !tbaa !7
  %.fca.7.0.0.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep.i, align 8, !tbaa !7
  %.fca.7.0.1.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 5, ptr %.fca.7.0.1.gep.i, align 8, !tbaa !7
  %.fca.7.0.2.gep.i = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep.i, align 8, !tbaa !7
  %78 = call i32 @_FortranAMinvalInteger4(ptr nonnull %1, ptr nonnull @_QQcl.462d20c6d9410c585a4841b1cab5f5bc, i32 17, i32 0, ptr null)
  call void @free(ptr %53)
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1)
  %.neg = add i32 %51, -10
  %79 = add i32 %.neg, %78
  %80 = call i1 @_FortranAioOutputInteger32(ptr %52, i32 %79)
  %81 = call i32 @_FortranAioEndIoStatement(ptr %52)
  ret void
}

define i32 @_QFPminlast(ptr nocapture readonly %0) local_unnamed_addr {
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %3 = tail call dereferenceable_or_null(20) ptr @malloc(i64 20)
  %4 = load i32, ptr %0, align 4, !tbaa !3
  %5 = add i32 %4, -1
  %6 = srem i32 %5, 10
  %7 = add nsw i32 %6, 1
  store i32 %7, ptr %3, align 4, !tbaa !3
  %8 = getelementptr i32, ptr %0, i64 1
  %9 = load i32, ptr %8, align 4, !tbaa !3
  %10 = add i32 %9, -1
  %11 = srem i32 %10, 10
  %12 = add nsw i32 %11, 1
  %13 = getelementptr i32, ptr %3, i64 1
  store i32 %12, ptr %13, align 4, !tbaa !3
  %14 = getelementptr i32, ptr %0, i64 2
  %15 = load i32, ptr %14, align 4, !tbaa !3
  %16 = add i32 %15, -1
  %17 = srem i32 %16, 10
  %18 = add nsw i32 %17, 1
  %19 = getelementptr i32, ptr %3, i64 2
  store i32 %18, ptr %19, align 4, !tbaa !3
  %20 = getelementptr i32, ptr %0, i64 3
  %21 = load i32, ptr %20, align 4, !tbaa !3
  %22 = add i32 %21, -1
  %23 = srem i32 %22, 10
  %24 = add nsw i32 %23, 1
  %25 = getelementptr i32, ptr %3, i64 3
  store i32 %24, ptr %25, align 4, !tbaa !3
  %26 = getelementptr i32, ptr %0, i64 4
  %27 = load i32, ptr %26, align 4, !tbaa !3
  %28 = add i32 %27, -1
  %29 = srem i32 %28, 10
  %30 = add nsw i32 %29, 1
  %31 = getelementptr i32, ptr %3, i64 4
  store i32 %30, ptr %31, align 4, !tbaa !3
  store ptr %3, ptr %2, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 1
  store i64 5, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %32 = call i32 @_FortranAMinvalInteger4(ptr nonnull %2, ptr nonnull @_QQcl.462d20c6d9410c585a4841b1cab5f5bc, i32 17, i32 0, ptr null)
  call void @free(ptr %3)
  ret i32 %32
}

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
define i32 @_QFProundup(ptr nocapture readonly %0) local_unnamed_addr #2 {
  %2 = load i32, ptr %0, align 4, !tbaa !3
  %3 = sitofp i32 %2 to float
  %4 = fmul contract float %3, 0x3FB99999A0000000
  %5 = tail call contract float @llvm.ceil.f32(float %4)
  %6 = fptosi float %5 to i32
  %7 = mul i32 %6, 10
  ret i32 %7
}

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 i32 @_FortranAMinvalInteger4(ptr, ptr, i32, i32, ptr) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.ceil.f32(float) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4

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

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