Generally, 'n' represent the sample size, 'p' is the probability of success in a single trial, and 'q' is the corresponding probability of failure in a single trial.
The given problem suggests that the randomly selected group consists of 390 subjects. It follows that the sample size considered contains 390 subjects,

The objective is to study the number of subjects who develop headaches.
So we declare here that the success for a trial is defined as a subject from the group being found to have developed headaches.
Given that 23% of the subjects given a placebo, develop headaches. So the probability that a randomly selected subject will develop headache, that is, the probability of success is given by,

Thus, the value of 'p' is obtained as,

It is known that success and failure are complementary events, so the sum of their probabilities must be unity,

Substitute the value and solve for 'q' as follows,

Thus, the value of 'q' is 0.77.