calculating output