  We prove that up to scaling there are only finitely many integral lattices L
of signature (2,n) with n>20 or n=17 such that the modular variety defined by
the orthogonal group of L is not of general type. In particular, when n>107,
every modular variety defined by an arithmetic group for a rational quadratic
form of signature (2,n) is of general type. We also obtain similar finiteness
in n>8 for the stable orthogonal groups. As a byproduct we derive finiteness of
lattices admitting reflective modular form of bounded vanishing order, which
proves a conjecture of Gritsenko and Nikulin.
