#include<stdio.h>
#include<algorithm>
#include<unistd.h>
#include<string.h>
typedef unsigned int uint;
using namespace std;
union block{
uint v[16];
char s[64];
};
uint h0, h1, h2, h3, h4;
uint LR(uint a, int x){
return a << x | a >> 32-x;
}
block buf[10000];
int main()
{
h0 = 0x67452301;
h1 = 0xEFCDAB89;
h2 = 0x98BADCFE;
h3 = 0x10325476;
h4 = 0xC3D2E1F0;
int len = read(0, buf[0].s, 640000), nbits = len * 8;
buf[0].s[len++] = 0x80;
printf("%d\n", nbits);
// if(len%64 != 56) return !printf("length != 55 (mod 64)\n");
uint nblock = (len+7)/64 + 1;
buf[nblock-1].v[14] = 0;
buf[nblock-1].v[15] = nbits;
for(int t = 0; t < nblock; t++){
block cur = buf[t];
printf("\n\n");
for(int i = 0; i < 64; i++) printf("%c", cur.s[i]);
printf("\n\n");
for(int i = 0; i < 16; i++){
if(t == nblock-1 && i == 15) continue;
swap(cur.s[i*4+0], cur.s[i*4+3]);
swap(cur.s[i*4+1], cur.s[i*4+2]);
}
uint w[16];
for(int i = 0; i < 16; i++) w[i] = cur.v[i];
uint a, b, c, d, e, f, k;
a = h0; b = h1; c = h2; d = h3; e = h4;
for(int i = 0; i < 80; i++){
if(i >= 16) w[i%16] = LR(w[(i-3+16)%16]^w[(i-8+16)%16]^w[(i-14+16)%16]^w[(i-16+16)%16], 1);
if(i <= 19){
f = (b&c)|(~b&d);
k = 0x5A827999;
}
else if(i <= 39){
f = (b^c^d);
k = 0x6ED9EBA1;
}
else if(i <= 59){
f = (b&c)|(b&d)|(c&d);
k = 0x8F1BBCDC;
}
else if(i <= 79){
f = b^c^d;
k = 0xCA62C1D6;
}
uint tmp = LR(a, 5) + f + e + k + w[i%16];
e = d; d = c; c = LR(b, 30); b = a; a = tmp;
}
h0 = h0 + a;
h1 = h1 + b;
h2 = h2 + c;
h3 = h3 + d;
h4 = h4 + e;
printf("h0 = 0x%08x; h1 = 0x%08x; h2 = 0x%08x; h3 = 0x%08x; h4 = 0x%08x;\n", h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