Divide, Reweight, and Conquer: A Logit Arithmetic Approach for In-Context Learning