package main import ( "bufio" "fmt" "os" "strconv" "math" "strings" ) func main() { N := InputInt() var c, d, a int64 mod := int64(math.Pow(10, 9)) + 7 for i := 0; i < N; i++ { s := strings.Split(Input(), " ") c = ToInt64(s[0]) d = ToInt64(s[1]) a += ((c + 1) / 2 * d) % mod } Print(a % mod) } func Print(x ...interface{}){ l := len(x) - 1 for ii, vi := range x { fmt.Print(vi) if ii == l { fmt.Print("\n") } else { fmt.Print(" ") } } } var sc = bufio.NewScanner(os.Stdin) func Input() string { sc.Scan() return sc.Text() } func InputInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil {panic(e)} return i } func BinCount(x int) int { s := fmt.Sprintf("%b", x) c := 0 for _, i := range s { if i == '1' {c += 1} } return c } func ToInt(x string) int { i, e := strconv.Atoi(x) if e != nil {panic(e)} return i } func ToInt64(x string) int64 { i, e := strconv.ParseInt(x, 10, 64) if e != nil {panic(e)} return i }