#define ssh(x)<x>
#include ssh(bits/stdc++.h)
#define rfor(x...)for(register x)
#define rep(i,l,r)rfor(ll i=l;i<=r;i++)
#define ref(i,l,r)rfor(ll i=l;i<r;i++)
#define per(i,l,r)rfor(ll i=l;i>=r;i--)
#define rev(i,u,v)rfor(ll i=head[u],v;v=to[i],i;i=next[i])
#define rej(i,s)rfor(ll i=s;i;i=(i-1)&(s))
#define re0(i,s)rfor(ll i=s;~i;i=i?(i-1)&(s)):-1)
#define red(i,n)rfor(ll i=n;i;i>>=1)
#define IO(x...)((*#x!='/'||#x[1])&&(*#x&&freopen(#x".in","r",stdin)&&freopen(#x".out","w",stdout),gc=fgc,pc=fpc,atexit(fout)))
typedef long long ll;
typedef const ll cll;
typedef unsigned long long ull;
cll N=1e6+7,mod=998244353,iv2=(mod+1)/2,iz=1<<21,oz=1<<22;
typedef ll aN[N];
char is[iz],*i1=is,*i2=is,os[oz],*o1=os,*o2=os+oz;
int fgc(){
    return i1==i2&&is==(i2=is+fread(i1=is,1,iz,stdin))?-1:*i1++;
}
void fout(){
    fwrite(os,o1-os,1,stdout),o1=os;
}
int fpc(int c){
    if(o1==o2)fout();
    return*o1++=c;
}
int(*gc)()=getchar,(*pc)(int)=putchar,wt[126];
int readchar(int l=33,int r=126){
    if(l>r)std::swap(l,r);
    int c=gc();
    for(;c<l||c>r;c=gc());
    return c;
}
ll readll(){
    ll x=0,w=1;
    int c=gc();
    for(;c<48||c>57;c=gc())c-45||(w=-w);
    for(;c>47&&c<58;c=gc())x=x*10+c-48;
    return x*w;
}
void writell(cll u,int c=32){
    int t=0;
    rfor(ull n=u<0?pc(45),0ull-u:u;n;n/=10)wt[++t]=n%10^48;
    for(t||pc(48);t;)pc(wt[t--]);
    c&&pc(c);
}
int mygets(char*s,int c=0){
    char*t=s+1;
    while((*s=gc())<33);
    while((*t=gc())>32)t++;
    c&&(*t++=c),*t=0;
    return t-s;
}
int myputs(const char*s,int c=10){
    const char*t=s;
    while(*t)pc(*t++);
    c&&pc(c);
    return t-s+(c!=0);
}
cll IO_res=IO(plant),T=3,S=0;
void init(){
}
char s[1111][1111];
ll a[1111][1111],b[1111][1111],c[1111][1111],d[1111][1111];
void calc(){
    cll n=1000,m=1000,C=1,F=1;
    //rep(i,1,n)mygets(s[i]+1);
    rep(i,1,n)rep(j,1,m)s[i][j]=((i&j)&1)^'1';
    ll ansc=0,ansf=0;
    per(i,n,1)per(j,m,1){
        a[i][j]=s[i][j]=='1'?0:(a[i][j+1]+1)%mod;
        d[i][j]=s[i][j]=='1'?0:(d[i+1][j]+1)%mod;
        b[i][j]=s[i][j]=='1'?0:(b[i+1][j]+std::max(0ll,a[i][j]-1))%mod;
        c[i][j]=s[i][j]=='1'?0:(c[i+1][j]+std::max(0ll,a[i][j]-1)*std::max(0ll,d[i][j]-1))%mod;
        //printf("%lld %lld %lld %lld %lld %lld\n",i,j,a[i][j],b[i][j],c[i][j],d[i][j]);
        if(s[i][j]=='0'&&s[i+1][j]=='0'){
            ansc=(ansc+(a[i][j]-1)*b[i+2][j])%mod;
            ansf=(ansf+(a[i][j]-1)*c[i+2][j])%mod;
        }
    }
    writell(ansc*C),writell(ansf*F,10);
}
int main(){
    init();
    rep(i,1,T)calc();
    return 0;
}
//solo@2022
//biu#2019miss
