#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 998244353;
int n, m, a[N], b[N];
char s[N];
long long ans;
long long qpow(long long a, int b) {
  long long ans = 1;
  for (; b; b >>= 1, a = a * a % mod)
    if (b & 1) ans = ans * a % mod;
  return ans;
}
int main() {
  cin >> n >> m >> s;
  for (int i = 0; i <= n - 1; i++) a[n - i - 1] = s[i] - '0';
  cin >> s;
  for (int i = 0; i <= m - 1; i++)
    b[m - i - 1] = s[i] - '0' + (i > 0) * b[m - i];
  for (int i = 0; i <= max(n, m); i++)
    (ans += a[i] * b[i] * qpow(2, i) % mod) %= mod;
  return printf("%lld\n", ans), 0;
}
