import java.io.*; class Numbritarbija extends Thread{ PipedInputStream lugemisvoog=new PipedInputStream(); public void run(){ int summa=0; int n=0; try{ DataInputStream andmelugemisvoog=new DataInputStream(lugemisvoog); while(true){ n++; int a=andmelugemisvoog.readInt(); summa+=a; if(n%1000==0){System.out.println(summa);} } }catch(Exception e){ System.out.println(e); } } }