#include #include #include using namespace std; using ll = long long; ll mygcd(ll a, ll b) { if (a%b == 0) { return(b); } else { return(mygcd(b, a%b)); } } int main(){ ll n,m; cin>>n>>m; assert(1<=n&&n<=2000&&1<=m&&m<=2000); vector a(n); vector b(m); for(int i=0;i=0&&a.at(i)<=100000000); cin>>a.at(i); } for(int i=0;i=0&&b.at(i)<=100000000); cin>>b.at(i); } ll ans=0; ll x,y; x=0; y=0; for(int i=0;i