added -O3 flag
skipping unnessary multiplikations of d