Is there any calculator shortcut to solve this?

You can use the STAT worksheet to calculate the mean return for A and B and the mean return for the product of A and B. Enter the probabilities as whole numbers for Y and calculate covariance as mean return for A and B -(mean return for A * mean return for B).