// mlen = 10
// a = 123
// b = 5678
// 3 2 1 0 0 0 0 0 0 0
// 8 7 6 5 0 0 0 0 0 0
// 1 0 8 5 0 0 0 0 0 0

#include <cstdio>
#include <cstring>
#include <cassert>

#include <algorithm>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;
typedef ll num[mlen];

void Read( ll *a, int n = mlen )
{
  static char s[mlen * blen];

  memset(a, 0, sizeof(a[0]) * n);
  gets(s);

  ll x = 1, b = 0;
  int j = 0;
  for (int i = strlen(s) - 1; i >= 0; i--)
  {
    b += x * (s[i] - '0'), x *= 10;
    assert(j < mlen);
    if (x == base || i == 0)
      a[j++] = b, b = 0, x = 1;
  }
}

void Out( ll *a, int n = mlen )
{
  int i = n - 1;
  while (i && !a[i])
    i--;
  printf("%I64d", a[i--]);
  while (i >= 0)
    printf("%0*I64d", blen, a[i--]);
  puts("");
}

int Len( ll *a )
{
  int i = mlen - 1;
  while (i > 0 && !a[i])
    i--;
  return i + 1;
}

int Cmp( ll *a, ll *b, int n = mlen )
{
  for (int i = n - 1; i >= 0; i--)
    if (a[i] != b[i])
      return (a[i] < b[i] ? -1 : 1);
  return 0;
}

void Inc( ll *a, int n = mlen )
{
  a[0]++;
  for (int i = 0; i < n - 1 && a[i] == base; i++)
    a[i] -= base, a[i + 1]++;
}

void Dec( ll *a, int n = mlen )
{
  a[0]--;
  for (int i = 0; i < n - 1 && a[i] < 0; i++)
    a[i] += base, a[i + 1]--;
}

void Shr( ll *x, int n = mlen )
{
  forn(i, n)
  {
    if (i && (x[i] & 1))
      x[i - 1] += base >> 1;
    x[i] >>= 1;
  }
}

void Add( ll *x, ll *a, ll *b, int n = mlen )
{
  forn(i, n)
    x[i] = a[i] + b[i];
  forn(i, n - 1)
    if (x[i] >= base)
      x[i + 1]++, x[i] -= base;
}

int base_cnt_div = 0;

void MulD( ll *x, ll *a, int k, int n = mlen )
{
  forn(i, n)
    x[i] = a[i] * k;
  forn(i, n - 1)
    if (x[i] >= base)
    {
      x[i + 1] += x[i] / base, x[i] %= base;
      base_cnt_div++;
    }
}

void Copy( ll *a, ll *b, int n )
{
  memcpy(a, b, sizeof(a[0]) * n);
}

void ShiftR( ll *a, int k, int n = mlen )
{
  forn(i, n - k)
    a[i] = a[i + k];
  forn(i, k)
    a[n - k + i] = 0;
}

void ShiftL( ll *a, int k, int n = mlen )
{
  for (int i = n - 1; i >= k; i--)
    a[i] = a[i - k];
  forn(i, k)
    a[i] = 0;
}