While Polish-Lithuanian army concentrated in Podolia, in deep south of the enormous Commonwealth, on August 19, 1621, a Swedish army landed near Pärnu , carried by a fleet of 148 vessels . Gustav Adolf had 14,700 infantry, 3,150 cavalry and 375 cannons. Swedes immediately marched towards Riga, and besieged it on 29 August. The capital of Livonia was defended by a garrison of 300 soldiers, plus 3,700 armed residents. Lithuanian Field Hetman Krzysztof Radziwiłł had only 1,500 soldiers at his disposal, as most units were in Podolia and Red Ruthenia. Riga capitulated on September 25, after a month siege and three assaults. On October 2, Swedes captured the fortress of Dunamunde. The invaders, marching through marshes and forests to avoid Lithuanian cavalry, entered the Duchy of Courland and Semigallia, capturing its capital, Mitau without resistance. Swedes then tried to capture the fortress of Koknese, but failed to do so, after a skirmish with Lithuanian cavalry of Aleksander Gosiewski. In early January 1622, the Swedes captured Valmiera, together with several smaller Livonian castles. Meanwhile, the forces under Hetman Radziwill grew to 3 000, which enabled the Lithuanians to seal several Swedish garrisons. On January 7, Radziwiłł recaptured Mitau, but for lack of artillery, he failed to seize its castle, whose garrison did not capitulate until July 6. A few weeks later, in late July 1622, main Swedish forces reached Mittau, and a prolonged battle ensued. Since the battle turned into a stalemate, on August 10, 1622, both sides signed a truce, which in 1623 was prolonged until March 1625. During the negotiations, envoys of Gustav Adolf suggested a Swedish-Lithuanian union.
Question: How many soldiers and residents in total defended the capital of Livonia?
Answer: 4000