#include<bits/stdc++.h>   using namespace std;      struct _field   {       bool white = false;   };         int mod = 998244353;         int main()   {       ios_base::sync_with_stdio(0);       cin.tie(0);       cout.tie(0);   #ifndef ONLINE_JUDGE       freopen( input.txt ,  r , stdin);       //freopen( a.out , w ,stdout); // console output is better (in most cases)   #else       // add i/o method of specific testing system   #endif          int n, m;       cin >> n >> m;       vector<vector<_field>> field(m + 1, vector<_field>(n + 1));       for(int y = 1; y <= n; ++y)       {           for(int x = 1; x <= m; ++x)           {               char temp;               cin >> temp;               if(temp ==  * )               {                   field[x][y].white = false;               }               if(temp ==  o )               {                   field[x][y].white = true;               }           }       }       long long sol = 0; // value       long long v = 0; // value       long long h = 0; // combinations that have a half to the left       long long e = 0; // combinations that are ended on the left       long long c = 1; // #combinations       for(int y = 0; y <= n; ++y)       {           for(int x = 0; x <= m; ++x)           {               long long nh = 0;               long long ne = 0;               // count if we match the color               nh = (c + e) % mod;               ne = h;                     c = ((c + e) % mod + h) % mod;               if(field[x][y].white)               {                   v = ((v * 2) % mod + ne) % mod;               }               else               {                   nh = 0;                   ne = 0;               }                  h = nh;               e = ne;              }       }       sol = v;       int sol1 = v;       v = 0;       h = 0; // combinations that have a half to the left       e = 0; // combinations that are ended on the left       c = 1; // black ones       for(int x = 0; x <= m; ++x)       {           for(int y = 0; y <= n; ++y)           {               long long nh = 0;               long long ne = 0;               // count if we match the color               nh = (c + e) % mod;               ne = h;                     c = ((c + e) % mod + h) % mod;               if(field[x][y].white)               {                   v = ((v * 2) % mod + ne) % mod;               }               else               {                   nh = 0;                   ne = 0;               }                  h = nh;               e = ne;              }       }       int sol2 = v;          sol = (sol + v) % mod;       //cout << sol1 <<   n ;       //cout << sol2 <<   n ;       cout << sol <<   n ;          return 0;   }   