(defconstant +mod+ 1000000007) (defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (res 0)) (dotimes (i n) (let* ((c (read)) (d (read))) (if (evenp c) (incf res (mod (* (floor c 2) d) +mod+)) (incf res (mod (* (floor (1+ c) 2) d) +mod+))))) (format t "~d~%" (mod res +mod+)))) (main)