import std.stdio; import std.string; import std.conv; import std.algorithm; import std.array; import std.range; import std.typecons; /// main ================== void main() { auto MOD = 1_000_000_007; long people; auto N = readln.strip.to!int; foreach(n; 0..N) { auto buf = readln.strip.split; long Ck = buf[0].to!long % MOD; long Dk = buf[1].to!long % MOD; auto add = (Ck + 1) / 2 * Dk; people += add; people %= MOD; } people.writeln; }