#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n);i++)
#define Graph vector<vector<int>>;
#define iterG(next_v, G, v) for(auto next_v : G[v]
#define ALL(a)  (a).begin(),(a).end()
const int MOD = 1000000007;
const int MAX = 510000;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    rep(i, n) cin>> s[i];
    vector<int> v(n);
    ll odd= 0;
    ll even=0;
    rep(i, n){
        int x=0;
        rep(j, m){
            if(s[i][j] == '1'){
                x++;
            }
        }
        x = x % 2;
        if(x ==0){
            even++;
        }else{odd++;}
    }
    cout << even * odd << endl;
    return 0;
}


#include <limits.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <cmath>
#include <iomanip>
#include <string>
#include <deque>
#include <assert.h>
#include <random>
#include <ctime>
#include <unordered_map>

#define pnode node*

typedef long long ll;
typedef long double ld;

using namespace std;

const ll mod = 998244353;

ll pw(ll a, ll b) {
    if (b == 0) {
        return 1;
    }
    ll b2 = b / 2;
    ll tmp = pw(a, b2);
    if (b % 2 == 0) {
        return (tmp * tmp) % mod;
    } else {
        return (((tmp * tmp) % mod) * a) % mod;
    }
}

ll sub(ll a, ll b) {
    return (a - b + mod) % mod;
}

ll add(ll a, ll b) {
    return (a + b) % mod;
}

ll mul(ll a, ll b) {
    return (a * b) % mod;
}

ll n, m;

ll cnt[5100][5100];

ll sm[5100][5100];

void solve(){
    cin >> n >> m;
    // cout << n << " " << m << endl;
    for (int i = 1; i <= 5000; ++i) {
        cnt[i][0] = 1;
    }
    for (int i = 1; i <= 5000; ++i) {
        for (int j = 1; j <= 5000; ++j) {
            if (j == 1) {
                cnt[i][j] = i;
            } else {
                cnt[i][j] = (cnt[i][j - 1] * i) % mod;
            }
        }
    }
    for (int i = 1; i <= 5000; ++i) {
        for (int j = 1; j <= 5000; ++j) {
            sm[i][j] = cnt[i][j];
            sm[i][j] += sm[i][j - 1];
            sm[i][j] %= mod;
        }
    }
    ll ans = 0;
    ll atleastonce = sub(pw(m, n), pw(m - 1, n));
    // cout << atleastonce << "\n";
    ans += atleastonce * m;
    // cout << ans << "\n";
    ans %= mod;
    for (int a = 1; a <= m; ++a) {
        for (int len = 1; len <= n; ++len) {
            ll minpos = 1;
            ll maxpos = n - len - 1;
            if (maxpos < minpos) {
                continue;
            }
            ans += mul(mul(cnt[m][n - len - 2], sub(cnt[m - 1][len], cnt[m - a][len])), (maxpos - minpos + 1));
            ans %= mod;
        }
    }
    cout << ans << "\n";
}

signed main(){
    ll t = 1;
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed;
    cout << setprecision(20);
    #ifdef DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
    #endif
    while(t--){
        solve();
    }
}
