#!/usr/bin/env python3 INPUT_WHEEL_TEETH = 40 OUTPUT_WHEEL_TEETH = 8 with open('input.txt') as file: content = file.read().strip() rotation_output = int(content) * (INPUT_WHEEL_TEETH // OUTPUT_WHEEL_TEETH) print(rotation_output.to_bytes((rotation_output.bit_length() + 7) // 8, 'big').decode())