var input = require("fs").readFileSync("input.txt").toString(); var rows = input.split("\n").filter((a)=>(a)).map((a)=>(a.split("\t").map((b)=>(parseInt(b))))); var divis = rows.map((a)=>(a.map((b)=>(a.map((c)=>(b/c)).filter((c)=>(c%1 == 0)).filter((c)=>(c!=1))[0])).filter((c)=>(c)))); console.log(divis.reduce((a, b)=>(a + parseInt(b))));