Firm will maximize profits (pi)
Take the first order conditions with respect to A, q,p (i.e partial derivative w/ respect to each set to zero)
next make sure second order condition is satisified.
Then solve for the A,q,p that maximize profits. Hope this helps