let the saving of A and B are 4M , 5M and the share in cost of gift are 3N, 4N respectively
According to the question
for A, 4M - 3N = (2/3) x 4M
⇒ M = 9N/4.............(i)
For B 5M - 4N = 145
⇒ 5 x (9N/4) - 4N = 145 [by Eq. (i)]
∴ N = 20
∴ Cost of gift = 3N + 4N = 7 x 20 = ₹ 140