package main import ( "bufio" "fmt" "io" "os" ) var modVar = int64(1e9) + int64(7) func solve(in io.Reader, out, err io.Writer) { num, size, count, total := 0, int64(0), int64(0), int64(0) fmt.Fscan(in, &num) for i := 0; i < num; i++ { fmt.Fscan(in, &size, &count) size = (size + 1) / 2 total = (total + (size % modVar * (count % modVar))) % modVar } fmt.Fprintln(out,total) } func main() { br := bufio.NewReaderSize(os.Stdin, int(1e7)) solve(br, os.Stdout, os.Stderr) }