I present a model in which firms differing in R&D productivity choose between ambitious research projects, which are socially desirable, and unambitious ones, which are socially undesirable. The patent office must decide how rigorously to examine applications, which affects the probability of weeding out bad applications but also how firms self-select into R&D. I show that when a subset of firms is financially constrained, the patent office should examine their applications more rigorously. This generates a number of predictions that I test by exploiting the 1982 reform that introduced firm-size dependent fees in the United States.