The charge flowing through a resistance R varies with time t as Q=at−bt2. The total heat produced in R is