#include "bignumber.h"
#include <iostream>
using namespace std;

int BigNumber::operator=(const int k)
{
    if(k>=0) {
        t.resize(0);
        int c = k;
        while(c!=0){
            t.push_back(c%10);
            c = c/10;
        }
    }
    return k;
}

BigNumber BigNumber::operator*(const int k)
{
    if(k<0) return *this;

    BigNumber bn;
    bn.t.resize(t.size());
    int c = 0;
    for(int i=0; i<(int)t.size(); ++i){
        int s = k*t[i] + c;
        bn.t[i] = s%10;
        c = s/10;
    }
    while(c!=0){
        bn.t.push_back(c%10);
        c = c/10;
    }

    return bn;
}

ostream& operator<<(ostream &o, const BigNumber &bn)
{
    if(bn.t.size()>0) {
        for(int i=0; i<(int)bn.t.size(); ++i) {
            o << bn.t[bn.t.size()-1-i];
        }
    } else o << 0;
    return o;
}

