#include <iostream>
#include <fstream>
#include <bitset>
using namespace std;
int main(int argc, char* argv[])
{
long num;
cin >> hex >> num;
unsigned char high = (num >> 8) & 0xFF;
unsigned char low = num & 0xFF;
short* sum = new short(high + low);
bitset<32> binNum(num);
bitset<16> binSum(*sum);
cout << "Binary number: " << binNum << endl;
cout << "Sum of bytes: " << binSum << endl;
ofstream ftxt(argv[1]);
ftxt << binNum;
ftxt.close();
ofstream fbin(argv[2]);
fbin << binSum;
fbin.close();
delete sum;
return 0;
}