calculate input