how do you do a gerund phrase as the subject?

Studying for my exams gave me a headache.