Capaz esto te sirve
Código PHP:
$inicio = 12354;
$a_sumar = mysql_query("SELECT SUM(campo_valor) as positivo FROM cartilla WHERE operacion='S' AND user = 'pepe' ");
$a_restar = ("SELECT SUM(campo_valor) as negativo FROM cartilla WHERE operacion='R' AND user = 'pepe' ");
$row_suma = mysql_fetch_assoc($a_sumar);
$row_restar = mysql_fetch_assoc($a_var);
$fin = $inicio + $row_suma['positivo'] - $row_restar['negativo'];