SUM and REPLACE

CodeForces - 920F