#include <bits/stdc++.h>

using namespace std;
namespace DEBUG {
    void __print(int x) {cerr << x;}
    void __print(long x) {cerr << x;}
    void __print(long long x) {cerr << x;}
    void __print(unsigned x) {cerr << x;}
    void __print(unsigned long x) {cerr << x;}
    void __print(unsigned long long x) {cerr << x;}
    void __print(float x) {cerr << x;}
    void __print(double x) {cerr << x;}
    void __print(long double x) {cerr << x;}
    void __print(char x) {cerr << '\'' << x << '\'';}
    void __print(const char *x) {cerr << '\"' << x << '\"';}
    void __print(const string &x) {cerr << '\"' << x << '\"';}
    void __print(bool x) {cerr << (x ? "true" : "false");}

    template<typename T, typename V>
    void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
    template<typename T>
    void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
    void _print() {cerr << "]\n";}
    template <typename T, typename... V>
    void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define rand __rand
    mt19937 generator(chrono::system_clock::now().time_since_epoch().count());
    template <class T = int>
    T rand(T range = numeric_limits <T> :: max()){
        return (T) (generator() % range);
    }
}
using namespace DEBUG;

template <class T,class U>
void maximize(T &lhs,U rhs){
    if(lhs < rhs)lhs = rhs;
}
template <class T,class U>
void minimize(T &lhs,U rhs){
    if(lhs > rhs)lhs = rhs;
}
template <class T>
T tabs(T x){
    return (x < (T)0 ? -x : x);
}

#define len(c) (int)((c).size())
#define llong int64_t
#define MASK(i) ((1LL) << (i))
#define BIT(x,i) (((x) >> (i)) & 1)
#define file_name "test"    /// FILE NAME HERE!!!

/* ================================= END OF TEMPLATE ================================= */

namespace MODULAR {
    template< class T, T MOD >
    class Modular {
    private :
        T value;
    public:
        using modular = Modular < T , MOD >;
        Modular < T, MOD > () : value(0){}
        explicit Modular< T, MOD > (const T &initValue) : value(initValue % MOD){ if(value < 0){ value += MOD; } }
        modular& operator = (const modular &other) { value = other.value; return *this; }
        bool operator <  (const modular &other) const { return value < other.value; }
        bool operator >  (const modular &other) const { return value > other.value; }
        bool operator == (const modular &other) const { return !(*this < other) && !(*this > other);}
        bool operator != (const modular &other) const { return !(*this == other); }
        bool operator <= (const modular &other) const { return !(*this > other); }
        bool operator >= (const modular &other) const { return !(*this < other); }
        friend ostream& operator << (ostream &out, const modular &other) { return out << other.value; }
        friend istream& operator >> (istream &inp, modular &other) { return inp >> other.value; }
        modular& operator += (const modular &x) { value = (value % MOD + x.value % MOD + MOD) % MOD; return *this; }
        modular& operator -= (const modular &x) { value = (value % MOD - x.value % MOD + MOD) % MOD; return *this; }
        modular operator - () const { return modular(0) - *this; }
        modular& operator ++ () { return (*this += modular(1)); }
        modular& operator -- () { return (*this -= modular(1)); }
        T multiply(T lhs,T rhs) const {
            int count_bit_mod = __builtin_popcountll(MOD);
            if((count_bit_mod << 1) < 64){
                return ( (lhs % MOD) * (rhs % MOD) ) % MOD;
            } else {
                T ret = 0;
                for(; rhs > 0; rhs >>= 1){
                    if(rhs % 2){
                        ret += lhs;
                        if(ret >= MOD)ret -= MOD;
                    }
                    lhs <<= 1;
                    if(lhs >= MOD)lhs -= MOD;
                }
                return ret;
            }
        }
        modular& operator *= (const modular &x) { value = multiply(value,x.value); return *this; }
        modular operator * (const modular &x){ return (modular(*this) *= x); }
        modular operator + (const modular &x) { return (modular(*this) += x); }
        modular operator - (const modular &x) { return (modular(*this) -= x); }
        T powerValue(T h) const {
            T ret = (T)1;
            T tmp_value = value;
            for(; h > (T)0 ;h /= (T)2){
                if(h % (T)2)ret = multiply(ret,tmp_value);
                tmp_value = multiply(tmp_value,tmp_value);
            }
            return ret;
        }
        T inverseValue() const { return powerValue(MOD - 2); }
        modular toPower(T h) const { return modular(powerValue(h)); }
        modular toInverse() const { return modular(inverseValue()); }
        T getValue() const { return value; }
    };
}
using namespace MODULAR;
using ModInt = int64_t;
const ModInt Base = (ModInt)998244353; 
using Mint = Modular<ModInt, Base>;

// Note: 'ModInt Base' must be prime number.

namespace Task{

    class Solver{
        public:

            vector < vector < vector < Mint > > > dp;
            string x,y;
            int Lx,Ly;
            
            void solve(){
                cin>>x>>y;
                Lx = len(x);
                Ly = len(y);
                dp.resize(Lx + 2,vector < vector < Mint > > (Ly + 2,vector < Mint > (2,Mint(0))));
                Mint ans = Mint(0);//f(0,0,0) + f(0,0,1);
                for(int i = 0;i <= Lx;++i){
                    for(int j = 0;j <= Ly;++j){
                        dp[i + 1][j][0] = dp[i + 1][j][0] + Mint(1);
                        dp[i][j + 1][1] = dp[i][j + 1][1] + Mint(1);
                        for(int flag = 0;flag < 2;++flag){
                            if(flag == 0 and i - 1 >= 0){
                                if(x[i] != x[i - 1]){
                                    dp[i + 1][j][0] += dp[i][j][0];
                                }
                                if(y[j] != x[i - 1]){
                                    dp[i][j + 1][1] += dp[i][j][0];
                                }
                            }
                            if(flag == 1 and j - 1 >= 0){
                                if(y[j] != y[j - 1]){
                                    dp[i][j + 1][1] += dp[i][j][1];
                                }
                                if(x[i] != y[j - 1]){
                                    dp[i + 1][j][0] += dp[i][j][1];
                                }
                            }
                        }
                        ans += dp[i][j][0] + dp[i][j][1];
                    }
                }
                //clog<<"db"<<' '<<ans<<'\n';
                function < Mint(const string&,int L) > calc = [&](const string &s,int L) -> Mint{
                    llong subs = 0;
                    for(int i = 0;i < len(s);++i){
                        int j = i;
                        while(j + 1 < len(s) and s[j] != s[j + 1]){
                            ++j;
                        }
                        int l = j - i + 1;
                        subs += (l * (l + 1) / 2) * L;
                        if(subs >= Base){
                            subs -= Base;
                        }
                        i = j;
                    }
                    //clog<<"db subs"<<' '<<subs<<'\n';
                    return Mint(subs);
                };
                ans -= calc(x,Ly + 1);
                ans -= calc(y,Lx + 1);
                cout<<ans<<'\n';
            }

            ~Solver(){} 
    };

    void solve(){
        int ntest = 1;
#ifndef  ONLINE_JUDGE
        ntest = 4; // single test to multitest.
#endif
        //cin>>ntest;  // multitest
        while(ntest--){
            Solver().solve();
        }
    }
}

int main(int argc, char** argv){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen(file_name".inp","r",stdin);
    //freopen(file_name".out","w",stdout);	
    #endif // ONLINE_JUDGE
    Task::solve();
}


### Prompt

Please create a solution in Cpp to the following problem:

You are given two strings x and y, both consist only of lowercase Latin letters. Let |s| be the length of string s.

Let's call a sequence a a merging sequence if it consists of exactly |x| zeros and exactly |y| ones in some order.

A merge z is produced from a sequence a by the following rules: 

  * if a_i=0, then remove a letter from the beginning of x and append it to the end of z; 
  * if a_i=1, then remove a letter from the beginning of y and append it to the end of z. 



Two merging sequences a and b are different if there is some position i such that a_i ≠ b_i.

Let's call a string z chaotic if for all i from 2 to |z| z_{i-1} ≠ z_i.

Let s[l,r] for some 1 ≤ l ≤ r ≤ |s| be a substring of consecutive letters of s, starting from position l and ending at position r inclusive.

Let f(l_1, r_1, l_2, r_2) be the number of different merging sequences of x[l_1,r_1] and y[l_2,r_2] that produce chaotic merges. Note that only non-empty substrings of x and y are considered.

Calculate ∑ _{1 ≤ l_1 ≤ r_1 ≤ |x| \\\ 1 ≤ l_2 ≤ r_2 ≤ |y|} f(l_1, r_1, l_2, r_2). Output the answer modulo 998 244 353.

Input

The first line contains a string x (1 ≤ |x| ≤ 1000).

The second line contains a string y (1 ≤ |y| ≤ 1000).

Both strings consist only of lowercase Latin letters.

Output

Print a single integer — the sum of f(l_1, r_1, l_2, r_2) over 1 ≤ l_1 ≤ r_1 ≤ |x| and 1 ≤ l_2 ≤ r_2 ≤ |y| modulo 998 244 353.

Examples

Input


aaa
bb


Output


24


Input


code
forces


Output


1574


Input


aaaaa
aaa


Output


0


Input


justamassivetesttocheck
howwellyouhandlemodulooperations


Output


667387032

Note

In the first example there are: 

  * 6 pairs of substrings "a" and "b", each with valid merging sequences "01" and "10"; 
  * 3 pairs of substrings "a" and "bb", each with a valid merging sequence "101"; 
  * 4 pairs of substrings "aa" and "b", each with a valid merging sequence "010"; 
  * 2 pairs of substrings "aa" and "bb", each with valid merging sequences "0101" and "1010"; 
  * 2 pairs of substrings "aaa" and "b", each with no valid merging sequences; 
  * 1 pair of substrings "aaa" and "bb" with a valid merging sequence "01010"; 



Thus, the answer is 6 ⋅ 2 + 3 ⋅ 1 + 4 ⋅ 1 + 2 ⋅ 2 + 2 ⋅ 0 + 1 ⋅ 1 = 24.

### Response

```cpp
#include <bits/stdc++.h>

using namespace std;
namespace DEBUG {
    void __print(int x) {cerr << x;}
    void __print(long x) {cerr << x;}
    void __print(long long x) {cerr << x;}
    void __print(unsigned x) {cerr << x;}
    void __print(unsigned long x) {cerr << x;}
    void __print(unsigned long long x) {cerr << x;}
    void __print(float x) {cerr << x;}
    void __print(double x) {cerr << x;}
    void __print(long double x) {cerr << x;}
    void __print(char x) {cerr << '\'' << x << '\'';}
    void __print(const char *x) {cerr << '\"' << x << '\"';}
    void __print(const string &x) {cerr << '\"' << x << '\"';}
    void __print(bool x) {cerr << (x ? "true" : "false");}

    template<typename T, typename V>
    void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
    template<typename T>
    void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
    void _print() {cerr << "]\n";}
    template <typename T, typename... V>
    void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define rand __rand
    mt19937 generator(chrono::system_clock::now().time_since_epoch().count());
    template <class T = int>
    T rand(T range = numeric_limits <T> :: max()){
        return (T) (generator() % range);
    }
}
using namespace DEBUG;

template <class T,class U>
void maximize(T &lhs,U rhs){
    if(lhs < rhs)lhs = rhs;
}
template <class T,class U>
void minimize(T &lhs,U rhs){
    if(lhs > rhs)lhs = rhs;
}
template <class T>
T tabs(T x){
    return (x < (T)0 ? -x : x);
}

#define len(c) (int)((c).size())
#define llong int64_t
#define MASK(i) ((1LL) << (i))
#define BIT(x,i) (((x) >> (i)) & 1)
#define file_name "test"    /// FILE NAME HERE!!!

/* ================================= END OF TEMPLATE ================================= */

namespace MODULAR {
    template< class T, T MOD >
    class Modular {
    private :
        T value;
    public:
        using modular = Modular < T , MOD >;
        Modular < T, MOD > () : value(0){}
        explicit Modular< T, MOD > (const T &initValue) : value(initValue % MOD){ if(value < 0){ value += MOD; } }
        modular& operator = (const modular &other) { value = other.value; return *this; }
        bool operator <  (const modular &other) const { return value < other.value; }
        bool operator >  (const modular &other) const { return value > other.value; }
        bool operator == (const modular &other) const { return !(*this < other) && !(*this > other);}
        bool operator != (const modular &other) const { return !(*this == other); }
        bool operator <= (const modular &other) const { return !(*this > other); }
        bool operator >= (const modular &other) const { return !(*this < other); }
        friend ostream& operator << (ostream &out, const modular &other) { return out << other.value; }
        friend istream& operator >> (istream &inp, modular &other) { return inp >> other.value; }
        modular& operator += (const modular &x) { value = (value % MOD + x.value % MOD + MOD) % MOD; return *this; }
        modular& operator -= (const modular &x) { value = (value % MOD - x.value % MOD + MOD) % MOD; return *this; }
        modular operator - () const { return modular(0) - *this; }
        modular& operator ++ () { return (*this += modular(1)); }
        modular& operator -- () { return (*this -= modular(1)); }
        T multiply(T lhs,T rhs) const {
            int count_bit_mod = __builtin_popcountll(MOD);
            if((count_bit_mod << 1) < 64){
                return ( (lhs % MOD) * (rhs % MOD) ) % MOD;
            } else {
                T ret = 0;
                for(; rhs > 0; rhs >>= 1){
                    if(rhs % 2){
                        ret += lhs;
                        if(ret >= MOD)ret -= MOD;
                    }
                    lhs <<= 1;
                    if(lhs >= MOD)lhs -= MOD;
                }
                return ret;
            }
        }
        modular& operator *= (const modular &x) { value = multiply(value,x.value); return *this; }
        modular operator * (const modular &x){ return (modular(*this) *= x); }
        modular operator + (const modular &x) { return (modular(*this) += x); }
        modular operator - (const modular &x) { return (modular(*this) -= x); }
        T powerValue(T h) const {
            T ret = (T)1;
            T tmp_value = value;
            for(; h > (T)0 ;h /= (T)2){
                if(h % (T)2)ret = multiply(ret,tmp_value);
                tmp_value = multiply(tmp_value,tmp_value);
            }
            return ret;
        }
        T inverseValue() const { return powerValue(MOD - 2); }
        modular toPower(T h) const { return modular(powerValue(h)); }
        modular toInverse() const { return modular(inverseValue()); }
        T getValue() const { return value; }
    };
}
using namespace MODULAR;
using ModInt = int64_t;
const ModInt Base = (ModInt)998244353; 
using Mint = Modular<ModInt, Base>;

// Note: 'ModInt Base' must be prime number.

namespace Task{

    class Solver{
        public:

            vector < vector < vector < Mint > > > dp;
            string x,y;
            int Lx,Ly;
            
            void solve(){
                cin>>x>>y;
                Lx = len(x);
                Ly = len(y);
                dp.resize(Lx + 2,vector < vector < Mint > > (Ly + 2,vector < Mint > (2,Mint(0))));
                Mint ans = Mint(0);//f(0,0,0) + f(0,0,1);
                for(int i = 0;i <= Lx;++i){
                    for(int j = 0;j <= Ly;++j){
                        dp[i + 1][j][0] = dp[i + 1][j][0] + Mint(1);
                        dp[i][j + 1][1] = dp[i][j + 1][1] + Mint(1);
                        for(int flag = 0;flag < 2;++flag){
                            if(flag == 0 and i - 1 >= 0){
                                if(x[i] != x[i - 1]){
                                    dp[i + 1][j][0] += dp[i][j][0];
                                }
                                if(y[j] != x[i - 1]){
                                    dp[i][j + 1][1] += dp[i][j][0];
                                }
                            }
                            if(flag == 1 and j - 1 >= 0){
                                if(y[j] != y[j - 1]){
                                    dp[i][j + 1][1] += dp[i][j][1];
                                }
                                if(x[i] != y[j - 1]){
                                    dp[i + 1][j][0] += dp[i][j][1];
                                }
                            }
                        }
                        ans += dp[i][j][0] + dp[i][j][1];
                    }
                }
                //clog<<"db"<<' '<<ans<<'\n';
                function < Mint(const string&,int L) > calc = [&](const string &s,int L) -> Mint{
                    llong subs = 0;
                    for(int i = 0;i < len(s);++i){
                        int j = i;
                        while(j + 1 < len(s) and s[j] != s[j + 1]){
                            ++j;
                        }
                        int l = j - i + 1;
                        subs += (l * (l + 1) / 2) * L;
                        if(subs >= Base){
                            subs -= Base;
                        }
                        i = j;
                    }
                    //clog<<"db subs"<<' '<<subs<<'\n';
                    return Mint(subs);
                };
                ans -= calc(x,Ly + 1);
                ans -= calc(y,Lx + 1);
                cout<<ans<<'\n';
            }

            ~Solver(){} 
    };

    void solve(){
        int ntest = 1;
#ifndef  ONLINE_JUDGE
        ntest = 4; // single test to multitest.
#endif
        //cin>>ntest;  // multitest
        while(ntest--){
            Solver().solve();
        }
    }
}

int main(int argc, char** argv){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen(file_name".inp","r",stdin);
    //freopen(file_name".out","w",stdout);	
    #endif // ONLINE_JUDGE
    Task::solve();
}


```