#pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include int ri() { int n; scanf("%d", &n); return n; } #define LOOP 40003 int main() { int n = ri(); assert(n > 5); long double ans = 0; std::vector sins(LOOP + 1); std::vector coss(LOOP + 1); for (int i = 1; i <= LOOP; i++) sins[i] = sin((long double)i), coss[i] = cos((long double)i); for (int i = 0; i < n; i++) { long double x, a; scanf("%Lf%Lf", &x, &a); long double r0 = sin(x) * x; long double r1 = cos(x); long double r2 = x * x; long double res = 0; for (int j = LOOP; j; j--) res += (r0 * coss[j] - r1 * j * sins[j]) / (r2 - j * j); res *= 2; res += sin(x) / x; ans += res * a; } printf("%.12Lf\n", ans); return 0; }