#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 *, double);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n;
  scanf("%d", &n);
  double curr_t, curr_v, prev_t, prev_v, sum = 0.0;
  scanf("%lf %lf", &prev_t, &prev_v);
  while (--n) {
    scanf("%lf %lf", &curr_t, &curr_v);
    sum += (prev_v + curr_v) / 2.0 * (curr_t - prev_t);
    prev_t = curr_t;
    prev_v = curr_v;
  }
  printf("%.6f\n", sum / 1000.0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     11d2 <main+0xb2>
lea    0xe9b(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe6f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm2
subsd  -0x20(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    115f <main+0x3f>
movsd  -0x30(%rbp),%xmm0
movsd  0xe21(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xed0(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
addl   $0xffffffff,0x4(%rsp)
je     11d1 <main+0xb1>
xorpd  %xmm0,%xmm0
lea    0xead(%rip),%r14
lea    0x28(%rsp),%r15
lea    0x20(%rsp),%rbx
movsd  %xmm0,0x18(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x20(%rsp),%xmm4
movsd  0x8(%rsp),%xmm1
addsd  %xmm4,%xmm1
movsd  0x28(%rsp),%xmm2
movapd %xmm2,%xmm3
subsd  0x10(%rsp),%xmm3
mulsd  0xe52(%rip),%xmm1
mulsd  %xmm1,%xmm3
movsd  0x18(%rsp),%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm2,0x10(%rsp)
movsd  %xmm4,0x8(%rsp)
addl   $0xffffffff,0x4(%rsp)
jne    1170 <main+0x50>
jmp    11d5 <main+0xb5>
xorpd  %xmm0,%xmm0
divsd  0xe2b(%rip),%xmm0
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%lf %lf\00"
@.str.2 = [6 x i8] c"%.6f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store double 0.000000e+00, double* %7
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %6)
br label %10
10: ; preds = %14, %0
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %3, double* %4)
%16 = load double, double* %6
%17 = load double, double* %4
%18 = fadd double %16, %17
%19 = fdiv double %18, 2.000000e+00
%20 = load double, double* %3
%21 = load double, double* %5
%22 = fsub double %20, %21
%23 = load double, double* %7
%24 = call double @llvm.fmuladd.f64(double %19, double %22, double %23)
store double %24, double* %7
%25 = load double, double* %3
store double %25, double* %5
%26 = load double, double* %4
store double %26, double* %6
br label %10
27: ; preds = %10
%28 = load double, double* %7
%29 = fdiv double %28, 1.000000e+03
%30 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%lf %lf\00"
@.str.2 = [6 x i8] c"%.6f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast i32* %1 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = bitcast double* %2 to i8*
%9 = bitcast double* %3 to i8*
%10 = bitcast double* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %4, double* %5)
%13 = load i32, i32* %1
%14 = add nsw i32 %13, -1
store i32 %14, i32* %1
%15 = icmp eq i32 %14, 0
br i1 %15, label %30, label %16
16: ; preds = %0, %16
%17 = phi double [ %26, %16 ], [ 0.000000e+00, %0 ]
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3)
%19 = load double, double* %5
%20 = load double, double* %3
%21 = fadd double %19, %20
%22 = fmul double %21, 5.000000e-01
%23 = load double, double* %2
%24 = load double, double* %4
%25 = fsub double %23, %24
%26 = call double @llvm.fmuladd.f64(double %22, double %25, double %17)
store double %23, double* %4
store double %20, double* %5
%27 = load i32, i32* %1
%28 = add nsw i32 %27, -1
store i32 %28, i32* %1
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %16
30: ; preds = %16, %0
%31 = phi double [ 0.000000e+00, %0 ], [ %26, %16 ]
%32 = fdiv double %31, 1.000000e+03
%33 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %32)
ret i32 0
}