#import <stdio.h>
int main() {
	long a,b;
	scanf("%ld %ld",&a,&b);
	long ans;
	if(a>=0&&b>0){
		ans = (b>=a)?b-a:a-b+2;
	}else if(a<0&&b>0){
		ans = (b>=-a)?1+b+a:-b-a+1;
	}else if(a<0&&b<0){
		ans = (b>=a)?b-a:-b+a+2;
	}else if(a>0&&b<0){
		ans = (-b>=a)?-b-a+1:b+a+1;
	}else if(a<0&&b==0){
		ans = -a;
	}else if(a==0&&b<0){
		ans = -b+1;
	}else if(a>0&&b==0){
		ans = a+1;
	}
	printf("%ld\n",ans);
}

; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_854/source.m'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_854/source.m"
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"

@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1

; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
  %a = alloca i64, align 8
  %b = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
  %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
  %0 = load i64, ptr %a, align 8, !tbaa !5
  %sub54 = sub i64 0, %0
  %cmp = icmp sgt i64 %0, -1
  %1 = load i64, ptr %b, align 8
  %sub38 = sub i64 0, %1
  %cmp1 = icmp sgt i64 %1, 0
  %or.cond = select i1 %cmp, i1 %cmp1, i1 false
  br i1 %or.cond, label %if.then, label %if.else

if.then:                                          ; preds = %entry
  %cmp2.not = icmp ult i64 %1, %0
  %sub = sub nsw i64 %1, %0
  %sub3 = add nuw i64 %0, 2
  %add = sub i64 %sub3, %1
  %cond = select i1 %cmp2.not, i64 %add, i64 %sub
  br label %if.end73

if.else:                                          ; preds = %entry
  %cmp4 = icmp slt i64 %0, 0
  %or.cond75 = select i1 %cmp4, i1 %cmp1, i1 false
  br i1 %or.cond75, label %if.then7, label %if.else19

if.then7:                                         ; preds = %if.else
  %cmp9.not = icmp ult i64 %1, %sub54
  %add11 = add nsw i64 %1, %0
  %2 = sub nsw i64 0, %add11
  %cond18.p = select i1 %cmp9.not, i64 %2, i64 %add11
  %cond18 = add i64 %cond18.p, 1
  br label %if.end73

if.else19:                                        ; preds = %if.else
  %cmp22 = icmp slt i64 %1, 0
  %or.cond76 = select i1 %cmp4, i1 %cmp22, i1 false
  br i1 %or.cond76, label %if.then23, label %if.else33

if.then23:                                        ; preds = %if.else19
  %cmp24.not = icmp ult i64 %1, %0
  %sub26 = sub nsw i64 %1, %0
  %add29 = add nsw i64 %0, 2
  %add30 = sub i64 %add29, %1
  %cond32 = select i1 %cmp24.not, i64 %add30, i64 %sub26
  br label %if.end73

if.else33:                                        ; preds = %if.else19
  %cmp34 = icmp sgt i64 %0, 0
  %or.cond77 = select i1 %cmp34, i1 %cmp22, i1 false
  br i1 %or.cond77, label %if.then37, label %if.else49

if.then37:                                        ; preds = %if.else33
  %cmp39.not = icmp ugt i64 %0, %sub38
  %sub42 = sub nsw i64 %sub38, %0
  %add45 = add nsw i64 %1, %0
  %cond48.in = select i1 %cmp39.not, i64 %add45, i64 %sub42
  %cond48 = add nsw i64 %cond48.in, 1
  br label %if.end73

if.else49:                                        ; preds = %if.else33
  %cmp52 = icmp eq i64 %1, 0
  %or.cond78 = select i1 %cmp4, i1 %cmp52, i1 false
  br i1 %or.cond78, label %if.end73, label %if.else55

if.else55:                                        ; preds = %if.else49
  %cmp56 = icmp eq i64 %0, 0
  %or.cond79 = select i1 %cmp56, i1 %cmp22, i1 false
  br i1 %or.cond79, label %if.then59, label %if.else62

if.then59:                                        ; preds = %if.else55
  %add61 = sub i64 1, %1
  br label %if.end73

if.else62:                                        ; preds = %if.else55
  call void @llvm.assume(i1 %cmp34)
  call void @llvm.assume(i1 %cmp52)
  %add67 = add nuw nsw i64 %0, 1
  br label %if.end73

if.end73:                                         ; preds = %if.else49, %if.then7, %if.then37, %if.then59, %if.else62, %if.then23, %if.then
  %ans.0 = phi i64 [ %cond, %if.then ], [ %cond18, %if.then7 ], [ %cond32, %if.then23 ], [ %cond48, %if.then37 ], [ %add61, %if.then59 ], [ %add67, %if.else62 ], [ %sub54, %if.else49 ]
  %call74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
  ret i32 0
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #3

attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #4 = { nounwind }

!llvm.linker.options = !{}
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
