#include<stdio.h> #include<string.h> #define MaxSize 100 int f(int* A, int n) { int i, ans; for (i = 0; i < n - 1; i++) { A[i + 1] += 10 * (A[i] % 2); A[i] /= 2; } ans = A[n - 1] % 2; A[n - 1] /= 2; return ans; } int main() { char s[100]; while (gets(s)) { int i, j, ans, n = strlen(s); int A[n], B[MaxSize]; for (i = 0; i < MaxSize; i++)B[i] = 0; for (i = 0; i < n; i++)A[i] = (int)(s[i] - '0'); for (j = 0; j < MaxSize; j++)B[j] = f(A, n); for (j = MaxSize - 1; B[j] == 0; j--); while (j >= 0)printf("%d", B[j--]); printf("\n"); } }