Using the standard conversion of 1 GB = 1024 MB, a 40 GB drive holds 40,960 MB.
The arithmetic is simply 40 × 1024. Keep in mind that manufacturers often quote capacity in decimal gigabytes, so the figure your operating system reports will usually come out a little lower than 40,960.