First, you have to choose which one will be the probability p.
For example, when p[H]=q,
then the result will be (1-q)^6*q^4
On the other hand, when p[T]=q
then the situation will be totally opposite.(q^4*(1-q)^6)
Also, don't miss to do the derivative.