#include<bits/stdc++.h>
#define MAXM 205
typedef long long ll;
using namespace std;

ll n,m;
ll cnt[3],ans;
char a[MAXM];

int main(){
	cin>>n>>m;
	ll zz = 0;
	for(int i = 1 ; i <= n ; i++){
		zz = 0;
		scanf("%s" , a + 1);
		for(int j = 1 ; j <= m ; j++)zz += (a[j] == '1');
		zz %= 2;
		if(zz % 2 == 1)ans += cnt[0];
		else ans += cnt[1];
		cnt[zz]++;
	}
	cout<<ans<<endl;
}

/*
AºÍB¿ÉÒÔÏàµÈ
cnt((A ^ B)) % 2 == 0
A + B % 2 == 0
*/
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
ll rand_int(ll l, ll r) //[l, r]
{
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution<ll>(l, r)(gen);
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int mod=998244353;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    ll ans=0;
    for(int i=1;i<=m;i++)
    {
        vc<ll> f(n+1),g(n+1),h(n+1);
        f[0]=1;
        for(int j=1;j<=n;j++)
        {
            f[j]=(f[j-1]*(m-1)%mod+g[j-1]*(i-1)%mod)%mod;
            g[j]=(g[j-1]*(m-i+1)%mod+f[j-1])%mod;
            h[j]=(h[j-1]*m%mod+f[j-1])%mod;
        }
        //dbg(i);
        //dbg(f);
        //dbg(g);
        //dbg(h);
        ans=(ans+h[n])%mod;
    }
    print(ans);
}