1. 

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #575 (SkewBinary)
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/external/5/575.pdf
*
* @author Christian Posselt
* @author Jonathan Schubert
* @version 1.0, 05/07/2009
*
* Status : Accepted
* Runtime: 0.080
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line = reader.readLine();
while(!line.equals("0"))
{
int sum = 0;
int pow = 2;
String base2= line;

for(int i = base2.length()-1; i >= 0; i --)
{
int digit = base2.charAt(i)-'0';
sum += digit*(pow-1);
//build pow of thow 2 4 8 16 ...
pow <<=1;
}
System.out.println(sum);
line = reader.readLine();
}
}
}

2.

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #575 Skew_Binary
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=13&page=show_problem&problem=1103
*
* @author Fabian Seidl
* @author Marcel Sachse
* @version 1.0, 29/04/2009
*
* Status : Accepted
* Runtime: 0.080
*/

import java.io.*;

public class Main
{

public static void main(String[] args) throws Exception
{

InputStreamReader bInput = new InputStreamReader(System.in);
BufferedReader bReader = new BufferedReader(bInput);

Writer out = new BufferedWriter(new PrintWriter(System.out));

for(String in = bReader.readLine(); !in.equals("0"); in = bReader.readLine())
{
char[] inChr = in.toCharArray();

int sum = 0;
int end = inChr.length-1;

for(int k=0;k<inChr.length;k++)
{
int digit = inChr[end-k]-'0';
if(digit>0)
{
int factor = (1 << (k+1)) - 1;
sum += digit * factor;
}
}
out.write(Integer.toString(sum)+"\n");
}

out.close();
}


}



3.

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #575 - Skew Binary
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=7&problem=516&mosmsg=Submission+received+with+ID+7133452
*
* @author Andre Wolfram
* @author Christoph Miesel
* @author Robert Seilbeck
* @version 13.0, 05/17/2009
*
* Status : Accepted
* Runtime 0.088
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));

String line;
while ((line = reader.readLine()) != null) {
if (line.equals("0")) {
break;
}
int result=0;
int k = 0;
for (int i = line.length() - 1; i >= 0; i--) {
int number = Integer.parseInt(String.valueOf(line.charAt(i)));
result+=(int) (number*(Math.pow(2, k+1)-1));
k++;
}
System.out.println(result);
}
}

}