Superconductivity and antiferromagnetism in the two-dimensional Hubbard model: scaling theory