Calculate the values of counters after applying all alternating operations