1 #include <iostream>
2 #include <cstdio>
3 #include <cstring>
4 #include <cstdlib>
5 #define min(a, b) ((a) < (b) ? (a) : (b))
6 #define max(a, b) ((a) > (b) ? (a) : (b))
7 inline void read(long long &x)
8 {
9 x = 0;char ch = getchar(), c = ch;
10 while(ch < ‘0‘ || ch > ‘9‘)c = ch, ch = getchar();
11 while(ch <= ‘9‘ && ch >= ‘0‘)x = x * 10 + ch - ‘0‘, ch = getchar();
12 if(c == ‘-‘)x = -x;
13 }
14
15 const long long INF = 0x3f3f3f3f;
16 const long long MAXN = 11000000 + 10;
17 const long long MOD = 20101009;
18
19 long long n,m,ma,mi,ans,miu[MAXN],bprime[MAXN],prime[MAXN],tot;
20
21 long long calc(long long n, long long m)
22 {
23 long long re = 0, last, x, y;
24 long long mi = min(n, m);
25 for(register long long d = 1;d <= mi;++ d)
26 {
27 x = n/d, y = m/d, last = min(mi, min(n/x, m/y));
28 x %= MOD, y %= MOD;
29 re += ((miu[last] - miu[d - 1]) * ((((x * (x + 1)/2)%MOD) * ((y * (y + 1)/2)%MOD))%MOD))%MOD;
30 re %= MOD;
31 d = last;
32 }
33 return re%MOD;
34 }
35
36 void make_miu()
37 {
38 miu[1] = 1;
39 for(register long long i = 2;i <= ma;++ i)
40 {
41 if(!bprime[i])
42 {
43 prime[++tot] = i;
44 miu[i] = -1;
45 }
46 for(register long long j = 1;j <= tot && i * prime[j] <= ma;++ j)
47 {
48 bprime[i * prime[j]] = 1;
49 if(i % prime[j] == 0)
50 {
51 miu[i * prime[j]] = 0;
52 break;
53 }
54 miu[i * prime[j]] = -miu[i];
55 }
56 }
57 for(register long long i = 1;i <= ma;++ i)miu[i] = (miu[i - 1] + (miu[i] * (i * i % MOD))%MOD)%MOD;
58 }
59
60 int main()
61 {
62 read(n), read(m);
63 mi = min(n, m), ma = max(n,m);
64 make_miu();
65 long long last, x, y;
66 for(register long long d = 1;d <= mi;++ d)
67 {
68 x = n/d, y = m/d,last = min(mi, min(n/x, m/y));
69 x %= MOD, y %= MOD;
70 ans += (calc(x, y)%MOD * (((d + last) * (last - d + 1) / 2)%MOD))%MOD;
71 ans %= MOD;
72 d = last;
73 }
74 printf("%lld", (ans + MOD)%MOD);
75 return 0;
76 }