# How to calculate the population survival probability in a two stage randomized clinical trial?

I am trying to reproduce a paper on two stage randomized clinical trials. In these clinical trials, a patient is randomized to either of the maintenance therapies $B_1$ or $B_2$ upon their remission after getting the induction therapy $A_1$. The remission probability is taken to be 0.80 and the 2nd stage randomization probability (to treatment $B$) is taken to be 0.50. They have generated survival times $(t)$ for patients getting induction therapy $A_1$ by calculating the following quantities.

#Generating remission status:
r<-rbinom(n,1,p1)

#Generating t0 from exponential with mean 182.5 days:
t0<-rep(0,n)
for(i in 1:n){
t0[i]<-ifelse(r[i]==0,rexp(1,1/(365*0.5)),0)
}

#Generating tr from exponential with mean 365 days:
tr<-rep(0,n)
for(i in 1:n){
tr[i]<-ifelse(r[i]==1,rexp(1,1/365),0)
}

#Generating B treatment indicator:
z<-rbinom(n,1,p3)

#Generating t1 from exponential with mean 365 days:
t1<-rep(0,n)
for(i in 1:n){
t1[i]<-ifelse(z[i]==1,rexp(1,1/365),0)
}

#Generating t2 from exponential with mean 547.5 days:
t2<-rep(0,n)
for(i in 1:n){
t2[i]<-ifelse(z[i]==0,rexp(1,1/365),0)
}

#Generating survival time t(i):
t<-rep(0,n)
for(i in 1:n){
t[i]<-(1-r[i])*t0[i]+r[i]*(tr[i]+z[i]*t1[i]+(1-z[i])*t2[i])
}

Now, I can't understand how do I calculate the population survival probability for treatment policy $A_1B_1$. Say, the assessing time is 700. I think I need to calculate the mean/rate from the sum of two Exponentials $tr$ and $t1$ by incorporating the probability of remission and the probability of second randomization. But I am not getting properly how to do it. For your convenience you can see this link.

For policy $A_1B_1$ the survival time can be obtained as:
$t(i)=(1-r(i))*t0+r(i)*(tr(i)+t1(i))$
We find $t(i)$ for a large number of times, say, 100,000 times or even more to get the population survival probability as follows:
$\frac{\sum I(t(i)>\text{assessing time})}{100,000}$