When the dividend is paid, the stock price on your tree should drop by the same amount. Ie if the dividend is 10 and the value of stock is 100 before the dividend at a node, you should change it to 90 and then continue building the tree from there. A cursory google brings quite a few results, eg this around slide 46 seems to explain it well
I provide a general algorithm and an implementation in R to solve those kinds of problems in general:
Financial Engineering: Static Replication of any Payoff Function.
For your example:
payoff <- data.frame(pi = c(0, 10, 30, 40, Inf), f_pi = c(30, 50, -10, 0, Inf))
## pi f_pi
## 1 0 30
## 2 10 50
## 3 30 -10
## 4 40 0
## 5 Inf Inf
Following further analysis, the results derived by Burgard and Kjaer rely on the assumption that the funding of the asset $S$ and the counterparty bond $P_C$ is fully achieved through the repo market, whereas funding for one's own bonds is unsecured.
To make the derivation more rigorous, let us formally introduce into their model the following well-defined ...