I want t calculate arithmetical mean from out "pin 1" to "pin 4" and use it on "pin 8"

I want to create my copter code through Ardupilot (APM 2.6 version), where main principle is calculation of arithmetical mean of four propeller and setting another additional propeller on that number. In other words, I want t calculate arithmetical mean from out “pin 1” to “pin 4” and use it on “pin 8”. Can anyone help or/and give an advice to write this additional function and put it in the "“source code”?

So you are looking for another throttle signal that is calculated on the state of the primary flight motors? Sorry I’m not much help but trying to more clearly understand.

Yes, you have understood correctly, I want to know arithmetical mean of
primary flight motors.
I want to know the following:

  1. how do motors are managed ?
  2. where can I add the function in source code and where should I make
  3. how can I use this meaning on the motor of pin 8?
    Can you help or at least direct me to someone else who could help?
    THanks beforehand

I try to more clearly understand.

I want to build a bit different Quadcopter, because one more servo 0 degree should be added on my Drone, where I’m planning to put the arithmetic mean of all four motors power. can you, please, help me to put motore on additional pin in source code? where can I add the function to calculate arithmetic mean?