Four. (50 points) $A$, $B$, and $C$ are playing table tennis. When two of them play, the other one acts as the referee. The loser of this match will be the referee in the next match, and the other two will continue playing. After several matches, it is known that $A$ has played a total of $a$ matches, and $B$ has played a total of $b$ matches. Find the minimum number of matches $C$ has played.

---

Please note that the translation maintains the original format and line breaks as requested.
Let $C$ have competed in $c$ matches. Then the total number of player appearances is $a+b+c$. However, each match produces 2 player appearances, so the total number of matches is $\frac{a+b+c}{2}$.
Therefore, the number of matches where $C$ was the referee is
$$
\frac{a+b+c}{2}-c=\frac{a+b-c}{2} \text{. }
$$

Since if $C$ is the referee in a certain match, he must compete in the next match, thus, in any two consecutive matches, $C$ cannot be the referee consecutively. Therefore, $\frac{a+b-c}{2} \leqslant c+1$.
Solving this, we get $c \geqslant \frac{a+b-2}{3}$.
Since $c$ is an integer, then
$$
c \geqslant\left[\frac{a+b-2}{3}+\frac{2}{3}\right]=\left[\frac{a+b}{3}\right] \text{. }
$$

When $a+b=3k$, $c \geqslant\left[\frac{a+b}{3}\right]=k$.
Using $(A, B, C)$ to denote the number of matches where $A$ and $B$ compete and $C$ is the referee. When all matches are
$$
(A, B, C),(A, C, B), \cdots,(A, B, C),(A, C, B)
$$

then, $a=2k, b=k, c=k$.
When $a+b=3k+1$, $c \geqslant\left[\frac{a+b}{3}\right]=k$.
But $a+b+c \equiv 0(\bmod 2)$, thus, $c \neq k$.
Therefore, $c \geqslant k+1$.
When all matches are
$$
(A, B, C),(A, C, B), \cdots,(A, B, C),(A, C, B),(B, C, A)
$$

then, $a=2k, b=k+1, c=k+1$.
When $a+b=3k+2$, $c \geqslant\left[\frac{a+b}{3}\right]=k$.
When all matches are
$$
\frac{(A, B, C),(A, C, B), \cdots,(A, B, C),(A, C, B),(A, B, C)}{2k=0)}
$$

then, $a=2k+1, b=k+1, c=k$.
In summary, $c_{\text{min}}=\left[\frac{a+b}{3}\right]+r$, where $r \in\{0,1\}$, and makes $21(a+b+c)$.