integer a,b,c,x,y,ans
read*,a,b,c,x,y
ans=b*max(y-x,0)+c*2*x
ans=min(ans,a*max(x-y,0)+c*2*y)
ans=min(ans,a*x+b*y)
print"(i0)",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"

@_QQcl.e0ff285b48b62d4614ede6985b18f924 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6055/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 i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.e0ff285b48b62d4614ede6985b18f924, i32 2)
  %7 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %1, i32 4)
  %8 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %2, i32 4)
  %9 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %3, i32 4)
  %10 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %4, i32 4)
  %11 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %5, i32 4)
  %12 = call i32 @_FortranAioEndIoStatement(ptr %6)
  %13 = load i32, ptr %2, align 4, !tbaa !3
  %14 = load i32, ptr %5, align 4, !tbaa !3
  %15 = load i32, ptr %4, align 4, !tbaa !3
  %16 = sub i32 %14, %15
  %17 = call i32 @llvm.smax.i32(i32 %16, i32 0)
  %18 = mul i32 %17, %13
  %19 = load i32, ptr %3, align 4, !tbaa !3
  %20 = shl i32 %19, 1
  %21 = mul i32 %20, %15
  %22 = add i32 %18, %21
  %23 = load i32, ptr %1, align 4, !tbaa !3
  %24 = sub i32 %15, %14
  %25 = call i32 @llvm.smax.i32(i32 %24, i32 0)
  %26 = mul i32 %23, %25
  %27 = mul i32 %20, %14
  %28 = add i32 %26, %27
  %29 = call i32 @llvm.smin.i32(i32 %22, i32 %28)
  %30 = mul i32 %23, %15
  %31 = mul i32 %14, %13
  %32 = add i32 %30, %31
  %33 = call i32 @llvm.smin.i32(i32 %29, i32 %32)
  %34 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.e0ff285b48b62d4614ede6985b18f924, i32 6)
  %35 = call i1 @_FortranAioOutputInteger32(ptr %34, i32 %33)
  %36 = call i32 @_FortranAioEndIoStatement(ptr %34)
  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 @_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.smax.i32(i32, i32) #0

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