#include #include #include #include using namespace std; int main(void){ for (;!feof(stdin);) { int count; if (scanf("%d", &count) != 1) break; vector> coords; map pravo; map lavo; coords.resize(count); for ( int i = 0; i < count; i++ ) { std::vector inner_coords; inner_coords.resize(2); int x,y; scanf("%d %d", &x, &y); inner_coords[0] = x; inner_coords[1] = y; lavo[x+y] += 1; pravo[x-y] += 1; /*else if( x < 0 ) { if( y > 0 ) { lavo[x+y] += 1; pravo[x-y] += 1; } if( y < 0 ) { lavo[x+y] += 1; pravo[x-y] += 1; } }*/ coords[i] = inner_coords; } int all = count * count; int win = 0; for ( auto it = pravo.begin(); it != pravo.end(); it++ ) { win += it->second * (it->second-1); } for ( auto it = lavo.begin(); it != lavo.end(); it++ ) { win += it->second * (it->second-1); } printf("%f\n", win/double(all)); //printf("w:%d all:%d === %f\n", win, all, win/double(all)); } return 0; }