#import <stdio.h>
#import <stdlib.h>
typedef long long INT;
int main(){
    INT N;
    scanf("%lld",&N);
    INT *S = (INT*)malloc((N+1)*sizeof(INT));
    S[0] = 0;
    INT sign = 1;
    for(INT i=1;i<=N;i++){
        INT a;
        scanf("%lld",&a);
        S[i] = S[i-1] + sign * a;
        sign *= -1;
    }
    sign = 1;
    for(INT i=1;i<=N;i++){
        printf("%lld", sign * (S[N]-2*S[i-1]));
        sign *= -1;
        if(i<N) printf(" ");
    }
}

; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_245/source.m'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_245/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 [5 x i8] c"%lld\00", align 1

; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
  %N = alloca i64, align 8
  %a = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
  %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
  %0 = load i64, ptr %N, align 8, !tbaa !5
  %add = shl i64 %0, 3
  %mul = add i64 %add, 8
  %call1 = call noalias ptr @malloc(i64 noundef %mul) #6
  store i64 0, ptr %call1, align 8, !tbaa !5
  %cmp.not39 = icmp slt i64 %0, 1
  br i1 %cmp.not39, label %for.cond.cleanup11, label %for.body

for.cond9.preheader:                              ; preds = %for.body
  %invariant.gep = getelementptr i64, ptr %call1, i64 -1
  %cmp10.not42 = icmp slt i64 %4, 1
  br i1 %cmp10.not42, label %for.cond.cleanup11, label %for.body12

for.body:                                         ; preds = %entry, %for.body
  %i.041 = phi i64 [ %inc, %for.body ], [ 1, %entry ]
  %sign.040 = phi i64 [ %mul7, %for.body ], [ 1, %entry ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
  %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
  %1 = getelementptr i64, ptr %call1, i64 %i.041
  %arrayidx3 = getelementptr i64, ptr %1, i64 -1
  %2 = load i64, ptr %arrayidx3, align 8, !tbaa !5
  %3 = load i64, ptr %a, align 8, !tbaa !5
  %mul4 = mul nsw i64 %3, %sign.040
  %add5 = add nsw i64 %mul4, %2
  store i64 %add5, ptr %1, align 8, !tbaa !5
  %mul7 = sub nsw i64 0, %sign.040
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
  %inc = add nuw nsw i64 %i.041, 1
  %4 = load i64, ptr %N, align 8, !tbaa !5
  %cmp.not.not = icmp slt i64 %i.041, %4
  br i1 %cmp.not.not, label %for.body, label %for.cond9.preheader

for.cond.cleanup11:                               ; preds = %for.inc23, %entry, %for.cond9.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5
  ret i32 0

for.body12:                                       ; preds = %for.cond9.preheader, %for.inc23
  %5 = phi i64 [ %9, %for.inc23 ], [ %4, %for.cond9.preheader ]
  %i8.044 = phi i64 [ %inc24, %for.inc23 ], [ 1, %for.cond9.preheader ]
  %sign.143 = phi i64 [ %mul20, %for.inc23 ], [ 1, %for.cond9.preheader ]
  %arrayidx13 = getelementptr inbounds i64, ptr %call1, i64 %5
  %6 = load i64, ptr %arrayidx13, align 8, !tbaa !5
  %gep = getelementptr i64, ptr %invariant.gep, i64 %i8.044
  %7 = load i64, ptr %gep, align 8, !tbaa !5
  %mul16 = shl nsw i64 %7, 1
  %sub17 = sub nsw i64 %6, %mul16
  %mul18 = mul nsw i64 %sub17, %sign.143
  %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %mul18)
  %mul20 = sub nsw i64 0, %sign.143
  %8 = load i64, ptr %N, align 8, !tbaa !5
  %cmp21 = icmp slt i64 %i8.044, %8
  br i1 %cmp21, label %if.then, label %for.inc23

if.then:                                          ; preds = %for.body12
  %putchar = call i32 @putchar(i32 32)
  %.pre = load i64, ptr %N, align 8, !tbaa !5
  br label %for.inc23

for.inc23:                                        ; preds = %for.body12, %if.then
  %9 = phi i64 [ %8, %for.body12 ], [ %.pre, %if.then ]
  %inc24 = add nuw nsw i64 %i8.044, 1
  %cmp10.not.not = icmp slt i64 %i8.044, %9
  br i1 %cmp10.not.not, label %for.body12, label %for.cond.cleanup11
}

; 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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) 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) #1

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

; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4

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 = { 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 #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { 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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
