Why was St. Petersburg founded?

A. To effectively battle the Swedish who had previously controlled the land.
B. To provide a port and access to Europe.
C. To replace Moscow, which had been destroyed in war.
D. To provide a military base for ongoing wars between Russia and Europe.