Horrible period cramps, can’t focus during test

How do I stop these cramps? Ibuprofen isn’t enough and I’m in sooo much pain I can’t focus on tests for school ☹️