of labor. The cultivation of coffee farther away from ports required the construction of railroads, first around Rio de Janeiro and into the Paraíba Valley, and later into the fertile highlands of São Paulo. In 1860 Brazil had only of railroads; by 1885 this total had increased to . The main rail link between São Paulo's eastern highlands and the ocean port of Santos allowed for a rapid expansion of coffee into the center and northwest of the state. After the initial coffee expansion, the availability of slaves dwindled, and further cultivation required additional slaves. However, by 1840 Brazil was already under pressure to abolish slavery, and a series of decrees were introduced, making it increasingly difficult to supply the new coffee areas with servile labor. In the 1870s, the shortage of labor became critical, leading to the gradual incorporation of free immigrant labor. The coffee expansion in the west-northwest of São Paulo State after 1880 was made possible largely by immigrant labor. In 1880 São Paulo produced 1.2 million 60-kilogram coffee bags, or 25% of Brazil's total; by 1888 this proportion had jumped to 40% (2.6 million bags); and by 1902, to 60% (8 million bags). In turn, between 1884 and 1890 some 201,000 immigrants had entered São Paulo State, and this total jumped to more than 733,000 between 1891 and 1900. By 1934, over 40% of the coffee production in São Paulo was produced by the 14.5 percent foreign population of the state. International mass immigration to Brazil during the 19th century caused a significant human capital increase because of the immigrants' superior formal and informal education and training. Slavery was abolished in 1888. The Brazilian economy grew considerably in the second half of the nineteenth century. Coffee was the mainstay of the economy, accounting for 63% of the country's exports in 1891, and 51% between 1901 and 1910. However, sugar, cotton, tobacco, cocoa, and, during the turn-of-the-century rubber boom, rubber were also important. During the first three decades of the 20th century, the Brazilian economy went through periods of growth but also difficulties caused in part by World War I, the Great Depression, and an increasing trend toward coffee overproduction. The four-year gap between the time a coffee tree is planted and the time of the first harvest magnified cyclical fluctuations in coffee prices, which in turn led to the increasing use of government price supports during