#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 40000 int main() { int n = ri(); long double ans = 0; std::vector sins(LOOP + 1001); std::vector coss(LOOP + 1001); for (int i = 1; i <= LOOP + 1000; 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; long double addition = 0; for (int j = LOOP; j; j--) res += (r0 * coss[j] - r1 * j * sins[j]) / (r2 - j * j); for (int j = LOOP + 1; j <= LOOP + 1000; j++) addition += (r0 * coss[j] - r1 * j * sins[j]) / (r2 - j * j); res += addition / 1000; res *= 2; res += sin(x) / x; ans += res * a; } printf("%.12Lf\n", ans); return 0; }