Hi thanks for your question.
You had unprotected sex after you periods.No chance of pregnancy
,since that was your safe period.If you want to take pregnancy test ,wait for your due date for next periods.Take pregnancy test 10 days after your missed periods (if that happens) Stomach pain most probably is not be related to sex.You may be having gastritis
(inflammation of stomach) which may be responsible for stomach pain.
Common reason for gastritis are spicy food,cigrette smoking
I would suggests you to consult a physician who may be able to evaluate you for pain abdomen.Meanwhile you can take antacids and H2 blockers like rantidine.
Hope this answers your question