import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto N = readln.strip.to!int; long[] C, D; foreach (_; 0 .. N) { auto input = readln.split.to!(long[]); C ~= input[0]; D ~= input[1]; } 0UL.reduce!((a,b) => a+(C[b]+1)/2*D[b])(0.iota(N)).writeln; }