Given that f(x) = 3x + 1 and g(x)=x2 - 2x-6, find (gof)(5).