#!/usr/bin/perl use strict; use warnings; use bigint; my $n = <>; my $total = 0; for(my $i = 0; $i < $n; $i++) { my ($c, $d) = split / /, <>; my $num = int(($c +1) / 2) * $d; $num %= (10**9 + 7); $total += $num; $total %= (10**9 + 7); } print "$total\n"; exit;