"""Original arithmetic from declared public inputs or explicit worked assumptions."""
import csv
from pathlib import Path
rc=761/37758;rp=597/18708;gap=rp*6.89-rc*7.67
results={'responder_chain_gap_units_per_person':gap,'control_nonresponse_share':1-rc,'promotion_nonresponse_share':1-rp,'needed_promotion_nonresponse_mean_if_control_0_2':((1-rc)*.2-gap)/(1-rp),'full_delta_per1000_if_control_0_2_promo0':(gap-(1-rc)*.2)*1000,'full_delta_per1000_if_both_0_2':(gap+(rc-rp)*.2)*1000,'break_even_common_nonresponder_mean':gap/(rp-rc)}
assert results['full_delta_per1000_if_control_0_2_promo0']<0<results['full_delta_per1000_if_both_0_2']
p=Path(__file__).parent/"data";p.mkdir(exist_ok=True)
with (p/"discount-nonresponder-frontier.csv").open("w",newline="") as f:
 w=csv.writer(f);w.writerow(["metric","value"]);w.writerows(results.items())
print(results)
