#pragma GCC optimize("O3,unroll-loops") #include #include std::uint32_t sums[1000010]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::uint32_t h, w; std::cin >> h >> w; std::uint32_t total = 0; for (std::uint32_t i = 0; i < h; ++i) { std::uint32_t sum = 0; std::uint32_t x; std::uint32_t j = 0; for (; j + 3 < w; j += 4) { std::uint32_t x0, x1, x2, x3; std::cin >> x0 >> x1 >> x2 >> x3; sum += x0 + x1 + x2 + x3; } for (; j < w; ++j) { std::cin >> x; sum += x; } sums[i] = sum; total += sum; } for (std::uint32_t i = 0; i < h; ++i) { std::cout << sums[i] + total << '\n'; } }