Let the population of A and B during the beginning of 2017 be 'a' and 'b' respectively.
After migration, population in A = 0.8a + 0.35b
And population in B = 0.65b + 0.2a
Also, 0.2a + 0.35b = 1130
4a + 7b = 22600 .. (i)
Number of females in A and B = 0.55 * (0.8a + 0.35b) + 0.4 * (0.65b + 0.2a) = 0.52a + 0.4525b
0.52a + 0.4525b = 1840
208a + 181b = 736000 .. (ii)
Solving (i) and (ii), we get
52(22600 - 7b) + 181b = 736000
1175200 - 364b + 181b = 736000
183b = 439200
b = 2400
So, a = 1450
Hence, total population = 1450 + 2400 = 3850