For all-purpose flour, 1 cup is approximately 127 grams. The type of flour makes a difference (1 cup of bread flour = 136g).
The humidity will affect how the flour packs in the measuring cup -- to minimize this effect you should sift before doing your final measurement. And do not pack the cup.
Using the 127g to 1c ratio, 400 grams would be converted as:
400/127 = 3.15 cups, or 3 cups plus 2-1/2 tablespoons.