How much mag cal should I take?

How much magnesium calcium should I take? Says 3 a day but that seems like a lot. 22 weeks. Midwife said to take it due to cramping in the legs