#import <stdio.h>
#import <stdlib.h>
#define ABS(a) ((a)>0?(a):(-(a)))
#define MIN(a,b) ((a)<(b)?(a):(b))

long minus(long a, long b, long c) {
    return (b-a)*(c-b)<0 ? 2*MIN(ABS(b-a),ABS(c-b)) : 0;
}

int main() {
    long N;
    scanf("%ld", &N);
    long *A = (long*)malloc(N * sizeof(long));
    long *MINUS = (long*)malloc(N * sizeof(long));

    A[0] = 0;
    long n;
    long i = 1;
    long SUM = 0;
    long current = 0;
    while (scanf("%ld", &n) != EOF) {
        A[i]=n;
        SUM += ABS(n-current);
        current = n;
        if (i>=2) {
            MINUS[i-1] = minus(A[i-2], A[i-1], A[i]);
        }
        i++;
    }
    SUM += ABS(current);
    MINUS[N] = minus(A[N-1],A[N],0);

    for (i=1;i<=N;i++) {
        printf("%ld\n", SUM-MINUS[i]);
    }
}

; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_572/source.m'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_572/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 [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @minus(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #0 {
entry:
  %sub = sub nsw i64 %b, %a
  %sub1 = sub nsw i64 %c, %b
  %mul = mul nsw i64 %sub1, %sub
  %cmp = icmp slt i64 %mul, 0
  br i1 %cmp, label %cond.true, label %cond.end42

cond.true:                                        ; preds = %entry
  %cond = tail call i64 @llvm.abs.i64(i64 %sub, i1 true)
  %cond16 = tail call i64 @llvm.abs.i64(i64 %sub1, i1 true)
  %cond39 = tail call i64 @llvm.umin.i64(i64 %cond, i64 %cond16)
  %mul40 = shl nuw nsw i64 %cond39, 1
  br label %cond.end42

cond.end42:                                       ; preds = %entry, %cond.true
  %cond43 = phi i64 [ %mul40, %cond.true ], [ 0, %entry ]
  ret i64 %cond43
}

; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
  %N = alloca i64, align 8
  %n = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #6
  %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
  %0 = load i64, ptr %N, align 8, !tbaa !5
  %mul = shl i64 %0, 3
  %call1 = call noalias ptr @malloc(i64 noundef %mul) #7
  %call3 = call noalias ptr @malloc(i64 noundef %mul) #7
  store i64 0, ptr %call1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
  %call471 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
  %cmp.not72 = icmp eq i32 %call471, -1
  br i1 %cmp.not72, label %while.end, label %if.end.peel

if.end.peel:                                      ; preds = %entry
  %1 = load i64, ptr %n, align 8, !tbaa !5
  %arrayidx5.peel = getelementptr inbounds i64, ptr %call1, i64 1
  store i64 %1, ptr %arrayidx5.peel, align 8, !tbaa !5
  %cond.peel = call i64 @llvm.abs.i64(i64 %1, i1 true)
  %call4.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
  %cmp.not.peel = icmp eq i32 %call4.peel, -1
  br i1 %cmp.not.peel, label %while.end, label %if.then

if.then:                                          ; preds = %if.end.peel, %if.end
  %current.075 = phi i64 [ %2, %if.end ], [ %1, %if.end.peel ]
  %SUM.074 = phi i64 [ %add, %if.end ], [ %cond.peel, %if.end.peel ]
  %i.073 = phi i64 [ %inc, %if.end ], [ 2, %if.end.peel ]
  %2 = load i64, ptr %n, align 8, !tbaa !5
  %arrayidx5 = getelementptr inbounds i64, ptr %call1, i64 %i.073
  store i64 %2, ptr %arrayidx5, align 8, !tbaa !5
  %sub = sub nsw i64 %2, %current.075
  %cond = call i64 @llvm.abs.i64(i64 %sub, i1 true)
  %add = add nuw nsw i64 %cond, %SUM.074
  %arrayidx12 = getelementptr i64, ptr %arrayidx5, i64 -2
  %3 = load i64, ptr %arrayidx12, align 8, !tbaa !5
  %sub13 = add nsw i64 %i.073, -1
  %arrayidx14 = getelementptr inbounds i64, ptr %call1, i64 %sub13
  %4 = load i64, ptr %arrayidx14, align 8, !tbaa !5
  %sub.i = sub nsw i64 %4, %3
  %sub1.i = sub nsw i64 %2, %4
  %mul.i = mul nsw i64 %sub1.i, %sub.i
  %cmp.i = icmp slt i64 %mul.i, 0
  br i1 %cmp.i, label %cond.true.i, label %if.end

cond.true.i:                                      ; preds = %if.then
  %cond.i = call i64 @llvm.abs.i64(i64 %sub.i, i1 true)
  %cond16.i = call i64 @llvm.abs.i64(i64 %sub1.i, i1 true)
  %cond39.i = call i64 @llvm.umin.i64(i64 %cond.i, i64 %cond16.i)
  %mul40.i = shl nuw nsw i64 %cond39.i, 1
  br label %if.end

if.end:                                           ; preds = %cond.true.i, %if.then
  %cond43.i = phi i64 [ %mul40.i, %cond.true.i ], [ 0, %if.then ]
  %arrayidx18 = getelementptr inbounds i64, ptr %call3, i64 %sub13
  store i64 %cond43.i, ptr %arrayidx18, align 8, !tbaa !5
  %inc = add nuw nsw i64 %i.073, 1
  %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
  %cmp.not = icmp eq i32 %call4, -1
  br i1 %cmp.not, label %while.end, label %if.then, !llvm.loop !9

while.end:                                        ; preds = %if.end, %if.end.peel, %entry
  %SUM.0.lcssa = phi i64 [ 0, %entry ], [ %cond.peel, %if.end.peel ], [ %add, %if.end ]
  %current.0.lcssa = phi i64 [ 0, %entry ], [ %1, %if.end.peel ], [ %2, %if.end ]
  %cond24 = call i64 @llvm.abs.i64(i64 %current.0.lcssa, i1 true)
  %add25 = add nuw nsw i64 %cond24, %SUM.0.lcssa
  %5 = load i64, ptr %N, align 8, !tbaa !5
  %6 = getelementptr i64, ptr %call1, i64 %5
  %arrayidx27 = getelementptr i64, ptr %6, i64 -1
  %7 = load i64, ptr %arrayidx27, align 8, !tbaa !5
  %8 = load i64, ptr %6, align 8, !tbaa !5
  %sub.i60 = sub nsw i64 %8, %7
  %9 = mul i64 %sub.i60, %8
  %notsub = add i64 %9, -1
  %cmp.i63 = icmp sgt i64 %notsub, -1
  br i1 %cmp.i63, label %cond.true.i65, label %minus.exit70

cond.true.i65:                                    ; preds = %while.end
  %cond.i66 = call i64 @llvm.abs.i64(i64 %sub.i60, i1 true)
  %cond16.i67 = call i64 @llvm.abs.i64(i64 %8, i1 true)
  %cond39.i68 = call i64 @llvm.umin.i64(i64 %cond.i66, i64 %cond16.i67)
  %mul40.i69 = shl nuw nsw i64 %cond39.i68, 1
  br label %minus.exit70

minus.exit70:                                     ; preds = %while.end, %cond.true.i65
  %cond43.i64 = phi i64 [ %mul40.i69, %cond.true.i65 ], [ 0, %while.end ]
  %arrayidx30 = getelementptr inbounds i64, ptr %call3, i64 %5
  store i64 %cond43.i64, ptr %arrayidx30, align 8, !tbaa !5
  %cmp31.not77 = icmp slt i64 %5, 1
  br i1 %cmp31.not77, label %for.end, label %for.body

for.body:                                         ; preds = %minus.exit70, %for.body
  %i.178 = phi i64 [ %inc35, %for.body ], [ 1, %minus.exit70 ]
  %arrayidx32 = getelementptr inbounds i64, ptr %call3, i64 %i.178
  %10 = load i64, ptr %arrayidx32, align 8, !tbaa !5
  %sub33 = sub i64 %add25, %10
  %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub33)
  %inc35 = add nuw nsw i64 %i.178, 1
  %11 = load i64, ptr %N, align 8, !tbaa !5
  %cmp31.not.not = icmp slt i64 %i.178, %11
  br i1 %cmp31.not.not, label %for.body, label %for.end

for.end:                                          ; preds = %for.body, %minus.exit70
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #6
  ret i32 0
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #5

attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.peeled.count", i32 1}
