#include <bits/stdc++.h>   using namespace std;   long long f[5005][5005];   long long mod = 1000000007, ans = 0;   char s1[5005], s2[5005];   int main() {     scanf( %s  n %s , s1 + 1, s2 + 1);     int len1 = strlen(s1 + 1);     int len2 = strlen(s2 + 1);     for (int i = 1; i <= len1; ++i)       for (int j = 1; j <= len2; ++j) {         if (s1[i] == s2[j]) f[i][j] = (f[i - 1][j - 1] + 1) % mod;         f[i][j] = (f[i][j] + f[i][j - 1]) % mod;       }     for (int i = 1; i <= len1; ++i) ans = (ans + f[i][len2]) % mod;     printf( %lld , ans);     return 0;   }   