#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ scanf(char *, long *, ...);
int main() {
  long int N, i, tot;
  long int x1, x2, y1, y2, dx, dy;
  scanf(" %ld", &N);
  tot = 0;
  for (i = 0; i < N; i++) {
    scanf(" %ld %ld %ld %ld", &x1, &y1, &x2, &y2);
    dx = x2 - x1;
    dy = y2 - y1;
    tot += dx * dx + dy * dy;
  }
  printf("%ld\n", tot);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed6(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    11c3 <main+0xa3>
lea    0xe9a(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x40(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
sub    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
sub    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rax
imul   -0x48(%rbp),%rax
mov    -0x50(%rbp),%rcx
imul   -0x50(%rbp),%rcx
add    %rcx,%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1151 <main+0x31>
mov    -0x20(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xed7(%rip),%rdi
xor    %ebp,%ebp
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpq   $0x0,(%rsp)
jle    11ab <main+0x8b>
lea    0x10(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0x8(%rsp),%rbx
xor    %r14d,%r14d
xor    %r15d,%r15d
nopl   (%rax)
lea    0xe99(%rip),%rdi
lea    0x20(%rsp),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x18(%rsp),%rax
sub    0x20(%rsp),%rax
mov    0x8(%rsp),%rbp
sub    0x10(%rsp),%rbp
imul   %rax,%rax
add    %r15,%rax
imul   %rbp,%rbp
add    %rax,%rbp
add    $0x1,%r14
mov    %rbp,%r15
cmp    (%rsp),%r14
jl     1160 <main+0x40>
lea    0xe5f(%rip),%rdi
mov    %rbp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c" %ld\00"
@.str.1 = [17 x i8] c" %ld %ld %ld %ld\00"
@.str.2 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %1
%11 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
store i64 0, i64* %4
store i64 0, i64* %3
br label %12
12: ; preds = %33, %0
%13 = load i64, i64* %3
%14 = load i64, i64* %2
%15 = icmp slt i64 %13, %14
br i1 %15, label %16, label %36
16: ; preds = %12
%17 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64* %5, i64* %7, i64* %6, i64* %8)
%18 = load i64, i64* %6
%19 = load i64, i64* %5
%20 = sub nsw i64 %18, %19
store i64 %20, i64* %9
%21 = load i64, i64* %8
%22 = load i64, i64* %7
%23 = sub nsw i64 %21, %22
store i64 %23, i64* %10
%24 = load i64, i64* %9
%25 = load i64, i64* %9
%26 = mul nsw i64 %24, %25
%27 = load i64, i64* %10
%28 = load i64, i64* %10
%29 = mul nsw i64 %27, %28
%30 = add nsw i64 %26, %29
%31 = load i64, i64* %4
%32 = add nsw i64 %31, %30
store i64 %32, i64* %4
br label %33
33: ; preds = %16
%34 = load i64, i64* %3
%35 = add nsw i64 %34, 1
store i64 %35, i64* %3
br label %12
36: ; preds = %12
%37 = load i64, i64* %4
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c" %ld\00"
@.str.1 = [17 x i8] c" %ld %ld %ld %ld\00"
@.str.2 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = bitcast i64* %1 to i8*
%7 = bitcast i64* %2 to i8*
%8 = bitcast i64* %3 to i8*
%9 = bitcast i64* %4 to i8*
%10 = bitcast i64* %5 to i8*
%11 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%12 = load i64, i64* %1
%13 = icmp sgt i64 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %0, %14
%15 = phi i64 [ %28, %14 ], [ 0, %0 ]
%16 = phi i64 [ %27, %14 ], [ 0, %0 ]
%17 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64* %2, i64* %4, i64* %3, i64* %5)
%18 = load i64, i64* %3
%19 = load i64, i64* %2
%20 = sub nsw i64 %18, %19
%21 = load i64, i64* %5
%22 = load i64, i64* %4
%23 = sub nsw i64 %21, %22
%24 = mul nsw i64 %20, %20
%25 = mul nsw i64 %23, %23
%26 = add i64 %24, %16
%27 = add i64 %26, %25
%28 = add nuw nsw i64 %15, 1
%29 = load i64, i64* %1
%30 = icmp slt i64 %28, %29
br i1 %30, label %14, label %31
31: ; preds = %14, %0
%32 = phi i64 [ 0, %0 ], [ %27, %14 ]
%33 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %32)
ret i32 0
}