// Problem: E. Chaotic Merge
// Contest: Codeforces - Educational Codeforces Round 106 (Rated for Div. 2)
// URL: http://codeforces.com/contest/1499/problem/E
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
using namespace std;

#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
// #define int long 
#define endl '\n'
#define vi vector<int>
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)

const int mod = 998244353;
int dx[]={0,1,1,1,0,-1,-1,-1};
int dy[]={1,1,0,-1,-1,-1,0,1};

// <--------------------Code Begins Here-------------------->
string s0, s1;
int n, m, dp[1005][1005][4][2][2];

int call(int i, int j, int f, int f1, int f2) {
	if(f == 3)return 1;
	if(i == n && j == m)return 0;
	int &ans = dp[i][j][f][f1][f2];
	if(ans != -1)return ans;
	ans = 0;
	int c;
	if(f2 == 0)c = 26;
	else {
		if(f1)c = (s1[j - 1] - 'a');
		else c = (s0[i - 1] - 'a');
	}
	if(f == 0) {
		if(i < n && (s0[i] - 'a') != c) {
			ans += call(i + 1, j, 0, 0, 1);
			ans %= mod;
			ans += call(i + 1, j, 1, 0, 1);
			ans %= mod;
		}
		if(j < m && (s1[j] - 'a') != c) {
			ans += call(i, j + 1, 0, 1, 1);
			ans %= mod;
			ans += call(i, j + 1, 2, 1, 1);
			ans %= mod;
		}
	}
	else if(f == 1) {
		if(j < m && (s1[j] - 'a') != c) {
			ans += call(i, j + 1, 1, 1, 1);
			ans %= mod;
			ans += call(i, j + 1, 3, 1, 1);
			ans %= mod;
		}
	}
	else if(f == 2) {
		if(i < n && (s0[i] - 'a') != c) {
			ans += call(i + 1, j, 2, 0, 1);
			ans %= mod;
			ans += call(i + 1, j, 3, 0, 1);
			ans %= mod;
		}
	}
	return ans;
}

int32_t main() {
    SPEED;
    int t = 1;
    // cin>>t;
    while(t--) {
    	cin>>s0>>s1;
    	n = s0.size();
    	m = s1.size();
    	fill(dp, -1);
    	int ans = 0;
    	for(int i = 0; i < n; ++i) {
    		for(int j = 0; j < m; ++j) {
    			ans += call(i, j, 0, 0, 0);
    			ans %= mod;
    		}
    	}
    	cout<<ans;
    }
    return 0;
}
### Prompt

In CPP, your task is to solve 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
// Problem: E. Chaotic Merge
// Contest: Codeforces - Educational Codeforces Round 106 (Rated for Div. 2)
// URL: http://codeforces.com/contest/1499/problem/E
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
using namespace std;

#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
// #define int long 
#define endl '\n'
#define vi vector<int>
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)

const int mod = 998244353;
int dx[]={0,1,1,1,0,-1,-1,-1};
int dy[]={1,1,0,-1,-1,-1,0,1};

// <--------------------Code Begins Here-------------------->
string s0, s1;
int n, m, dp[1005][1005][4][2][2];

int call(int i, int j, int f, int f1, int f2) {
	if(f == 3)return 1;
	if(i == n && j == m)return 0;
	int &ans = dp[i][j][f][f1][f2];
	if(ans != -1)return ans;
	ans = 0;
	int c;
	if(f2 == 0)c = 26;
	else {
		if(f1)c = (s1[j - 1] - 'a');
		else c = (s0[i - 1] - 'a');
	}
	if(f == 0) {
		if(i < n && (s0[i] - 'a') != c) {
			ans += call(i + 1, j, 0, 0, 1);
			ans %= mod;
			ans += call(i + 1, j, 1, 0, 1);
			ans %= mod;
		}
		if(j < m && (s1[j] - 'a') != c) {
			ans += call(i, j + 1, 0, 1, 1);
			ans %= mod;
			ans += call(i, j + 1, 2, 1, 1);
			ans %= mod;
		}
	}
	else if(f == 1) {
		if(j < m && (s1[j] - 'a') != c) {
			ans += call(i, j + 1, 1, 1, 1);
			ans %= mod;
			ans += call(i, j + 1, 3, 1, 1);
			ans %= mod;
		}
	}
	else if(f == 2) {
		if(i < n && (s0[i] - 'a') != c) {
			ans += call(i + 1, j, 2, 0, 1);
			ans %= mod;
			ans += call(i + 1, j, 3, 0, 1);
			ans %= mod;
		}
	}
	return ans;
}

int32_t main() {
    SPEED;
    int t = 1;
    // cin>>t;
    while(t--) {
    	cin>>s0>>s1;
    	n = s0.size();
    	m = s1.size();
    	fill(dp, -1);
    	int ans = 0;
    	for(int i = 0; i < n; ++i) {
    		for(int j = 0; j < m; ++j) {
    			ans += call(i, j, 0, 0, 0);
    			ans %= mod;
    		}
    	}
    	cout<<ans;
    }
    return 0;
}
```