If the sum of n terms of an AP is (3n2 + 5n) and its mth term is 164, find the value of m.