(n)=a(2^n)=3*2^n+n
S(n)=3*(2^1+2^2+2^3+...+2^n)+(1+2+3+...+n)
=3*(2^(n+1)-2)+n(n+1)/2
=3*2^(n+1)-6+n^2/2+n/2