Electric potential energy is a scalar quantity. In the formula, the values of charges q1 and q2 are kept with sign. If there are two or more charges in a system, then finding the electric potential energy of each pair of charges and adding them by algebraic method.
Example : If three charges q1 , -q2 , +q3 are at three corners of a triangle, then the electric potential energy of the system