#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
using ll = long long;
template<typename T> inline int sz(T &x) { return x.size(); }
inline int cLog2(const int x) { return (x == 1) ? 0 : 32-__builtin_clz(x-1); }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;



const int MOD  = 998244353;
const int proot = 3;

template<int MOD> struct ModInt {
  int x;
  ModInt(int _x = 0) : x( (0 <= _x && _x < MOD) ? _x : (_x%MOD+MOD)%MOD) {}
  constexpr int &value() noexcept { return x; }
  constexpr ModInt operator-() const noexcept { return ModInt(MOD-x); }
  constexpr ModInt operator+(const ModInt y) const noexcept { return ModInt(*this) += y; }
  constexpr ModInt operator-(const ModInt y) const noexcept { return ModInt(*this) -= y; }
  constexpr ModInt operator*(const ModInt y) const noexcept { return ModInt(*this) *= y; }
  constexpr ModInt operator/(const ModInt y) const noexcept { return ModInt(*this) /= y; }
  constexpr ModInt &operator+=(const ModInt y) noexcept { x += y.x; if (x >= MOD) x -= MOD; return *this; }
  constexpr ModInt &operator-=(const ModInt y) noexcept { x -= y.x; if (x < 0) x += MOD; return *this; }
  constexpr ModInt &operator*=(const ModInt y) noexcept { x = ll(x) * y.x % MOD; return *this; }
  constexpr ModInt &operator/=(const ModInt y) noexcept { x = ll(x) * y.inv().x % MOD; return *this; }
  constexpr ModInt inv() const noexcept {
    int a = x, b = MOD, u = 1, v = 0;
    while (b) {
      int t = a / b;
      a -= t * b; swap(a, b);
      u -= t * v; swap(u, v);
    }
    return (u < 0 ? (u + MOD) : u);
  }
};
using mint = ModInt<MOD>;
using Vm = vector<mint>;
istream &operator>>(istream &is, mint &a) { int v; cin >> v; a = v; return is; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }


mint pow(mint a, ll n) {
  mint x(1);
  for (; n > 0; n /= 2, a *= a) if (n&1) x *= a;
  return x;
}


void fmt(vector<mint> &f, const bool is_inv = false) {
  const int n = sz(f);
  const mint r = is_inv ? mint(proot).inv() : proot;
  vector<mint> g(n);
  for (int b = n/2; b > 0; b /= 2) {
    mint a = pow(r, (MOD-1) / (n/b));
    mint p = 1;
    for (int i = 0; i < n; i += 2*b) {
      rep(j, b) {
        f[i+j+b] *= p;
        g[i/2+j] = f[i+j] + f[i+j+b];
        g[n/2+i/2+j] = f[i+j] - f[i+j+b];
      }
      p *= a;
    }
    swap(f, g);
  }
  if (is_inv) {
    mint in = mint(n).inv();
    rep(i, n) f[i] *= in;
  }
}

void conv(vector<mint> &a, vector<mint> b) {
  const int n = sz(a) + sz(b) - 1;
  const int m = 1<<cLog2(n);
  a.resize(m); fmt(a);
  b.resize(m); fmt(b);
  rep(i, m) a[i] = a[i] * b[i];
  fmt(a, true);
  a.resize(n);
}


int main() {
  int n, m; cin >> n >> m;
  Vm a(n), b(m);
  cin >> a >> b;
  // rep(i, n) cin >> a[i];
  // rep(i, m) cin >> b[i];

  conv(a, b);
  cout << a << '\n';
  // rep(i, n+m-1) cout << c[i] << ' ';
  // cout << '\n';
}

Measured memory_bytes: 17576