#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0)
#define endl '\n'
typedef long long ll;
const int mod = 100000000;
const int N = 5e3 + 10;
char a[N], b[N];
int f[N][N], g[N][N];
signed main(){
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0)
#define endl '\n'
typedef long long ll;
const int mod = 100000000;
const int N = 5e3 + 10;
char a[N], b[N];
int f[N][N], g[N][N];
signed main(){