The Sum-Product Theorem and its Applications