Work done involving friction and other external forces 
A block of mass $1$ kg  is placed at the point A of rough track shown in figure. If slightly pushed towards right, it stops at B of track. Calculate work done by frictional force on the block during the transit from A to B.
I approached it by using conservation of energy.
Suppose there is no friction on the track. Then if the block is pushed from point A ,then it will not stop at point B but will have some velocity there say $Vb$. Now we can say easily that by conservation of energy, 
Initial P.E $+$ Initial K.E $=$ Final P.E $+$ Final K.E
Inital P.E $=$ mgH
Final P.E $=$ mgh
Final K.E $=\frac{1}{2}×$ m$Vb^2$.
Where H is inital height of point A and h is finally height of point B. So we get
mgH$=$ mgh$+\frac{1}{2}×$ m.$Vb^2$
But coming back to our problem, friction is present and this makes the block to stop at B. That means Final K.E$=0$. This means there is loss of $\frac{1}{2}×$ m.$Vb^2$ amount of energy. But I know that 
Initial Total Energy $=$ Final Total Energy 
So loss in the energy must have been converted to some other form. This another form might be heat energy produced by friction, which will be equall to work done by frictional force say $Wf$. So we should add this energy in the side of Final Total Energy. So our last equation would be 
mgH$=$ mgh $+$ $Wf$
So $Wf=$ mg$($ H $-$ h $) $.
Subsituting all values $Wf=(1)(9.8)(1-0.8)= 1.96 J$. But the answer was $-1.96 J$. Please tell me my mistake. I am very confused to solve questions regarding work done involving friction & external forces. If you can explain me any another simple way it would be very helpful to me.

You might say that displacement & frictional force are opposite to each other and hence $Wf$ should have been taken as negative but solving for the below question in a similar way gave me right answer

If I again use Initial Total Energy $=$ Final Total Energy.
Where Initial P.E of mass $1$ kg is $mghi$ and it's Final P.E is $mghf$ and Final K.E of $1$ kg block is $\frac{1}{2}× m.Vf1^2$ and Final K.E of $4$ kg block is $\frac{1}{2}× m.Vf4^2$. And adding similarly $Wf$ on Final Total Energy side, gives me equation:
$mghi=mghf + \frac{1}{2}× m.Vf1^2 + \frac{1}{2}× mVf4^2 + Wf$
$mg×(hi-hf)=\frac{1}{2}× mVf1^2 + \frac{1}{2}× mVf4^2 + Wf$.
Where $(hi-hf)=1$. Subsituting all values gives me right answer.Here also friction is opposite to displacement of $4$ kg block but taking $Wf$ positive gives right answer. Why?
 A: Consider this: you start out with a certain mechanical energy, $E_i$. As you move along, work ($W_x$) is done on the system, changing the mechanical energy of the system. At the end, the energy of the system is $E_f.$
Because energy is conserved, and we've restricted ourselves to mechanical interactions, the final energy must be the initial plus the work:
$$E_f = E_i + W_x.$$
$$W_x = E_f - E_i = mgh-mgH$$
Your mistake is you added work to the final mechanical energy rather than the initial mechanical energy.
A: The equation $K_{initial}+U_{initial}=K_{final}+U_{final}+W$ should rather be
$$K_{initial}+U_{initial}=K_{final}+U_{final}-W$$
Work done by friction is lost as heat. That is, work done by friction is removed from the system. Therefor there is less energy in the final stage - the energy amount $W$ has been removed. It must thus be subtracted here.
This is the case in both of your examples. In the latter example, naturally the final speeds of both boxes would have been higher (higher kinetic energies), had it not been for friction - work done by friction is removing energy from the system and thus must be subtracted so it reduces the final energy on the right-hand-side. That you get the right result in spite of the wrong use of sign must be due to another error somewhere. Please outline all steps in your calculation of the work $W$ and we'll have a look.
A: Energy is conserved. To use that law, you must add up all the energy you had at the start, and all the energy you have at the end. You had the right idea, but you didn't add up the right things. 
Initial K.E. = Final K.E. = $0$
You might as well leave that out. 
You have an Initial P.E. and a Final P.E. You also have a final heat which was generated from friction. 
Final heat = $-Wf$
Make a conservation of energy equation from those energies and try again. 

The minus sign needs some explanation. Work is done on an object when a force pushes it a distance. W = kinetic energy gained. 
$W = F \cdot d$
When $F$ and $d$ are in the same direction, the object accelerates and gains kinetic energy. W is positive. When they are in opposite directions, the object loses energy. W is negative. 
Here, the heat gained = kinetic energy lost = $-Wf$
